test: move to for of loop in test-http-hostname-typechecking.js

PR-URL: https://github.com/nodejs/node/pull/50782
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Luca Del Puppo 2023-12-22 07:06:01 +01:00 committed by GitHub
parent e1ad7fb38d
commit c9fe4b67dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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