Skip to content

Commit e080fb3

Browse files
refackaddaleax
authored andcommitted
test: ignore connection errors for hostname check
PR-URL: #14073 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 2a02868 commit e080fb3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/parallel/test-http-hostname-typechecking.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ vals.forEach((v) => {
1818
assert.throws(() => http.request({host: v}), errHost);
1919
});
2020

21-
// These values are OK and should not throw synchronously
21+
// These values are OK and should not throw synchronously.
22+
// Only testing for 'hostname' validation so ignore connection errors.
23+
const dontCare = () => {};
2224
['', undefined, null].forEach((v) => {
2325
assert.doesNotThrow(() => {
24-
http.request({hostname: v}).on('error', () => {}).end();
25-
http.request({host: v}).on('error', () => {}).end();
26+
http.request({hostname: v}).on('error', dontCare).end();
27+
http.request({host: v}).on('error', dontCare).end();
2628
});
2729
});

0 commit comments

Comments
 (0)