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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
refack authored and Fishrock123 committed Jul 19, 2017
1 parent 0a462fb commit 628fc49
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 628fc49

Please sign in to comment.