test: ignore connection errors for hostname check
PR-URL: https://github.com/nodejs/node/pull/14073 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
18069523f8
commit
4d7946aec3
@ -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();
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user