Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: ignore connection errors for hostname check
PR-URL: #14073
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
refack committed Jul 9, 2017
commit 4d7946aec33d23dd0c1fa1125937baad7e11a8e3
8 changes: 5 additions & 3 deletions test/parallel/test-http-hostname-typechecking.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ vals.forEach((v) => {
assert.throws(() => http.request({host: v}), errHost);
});

// These values are OK and should not throw synchronously
// These values are OK and should not throw synchronously.
// Only testing for 'hostname' validation so ignore connection errors.
const dontCare = () => {};
['', undefined, null].forEach((v) => {
assert.doesNotThrow(() => {
http.request({hostname: v}).on('error', () => {}).end();
http.request({host: v}).on('error', () => {}).end();
http.request({hostname: v}).on('error', dontCare).end();
http.request({host: v}).on('error', dontCare).end();
});
});