Skip to content

Commit

Permalink
test: ignore connection errors for hostname check
Browse files Browse the repository at this point in the history
PR-URL: #14073
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
refack authored and addaleax committed Jul 18, 2017
1 parent 2a02868 commit e080fb3
Showing 1 changed file with 5 additions and 3 deletions.
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();
});
});

0 comments on commit e080fb3

Please sign in to comment.