test: replace forEach() with for ... of in test-http2-single-headers.js

PR-URL: https://github.com/nodejs/node/pull/50606
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
spiritualized 2023-11-11 08:22:16 -05:00 committed by GitHub
parent 9223820d0e
commit 2c4bb21b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ server.on('stream', common.mustNotCall());
server.listen(0, common.mustCall(() => { server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`); const client = http2.connect(`http://localhost:${server.address().port}`);
singles.forEach((i) => { for (const i of singles) {
assert.throws( assert.throws(
() => client.request({ [i]: 'abc', [i.toUpperCase()]: 'xyz' }), () => client.request({ [i]: 'abc', [i.toUpperCase()]: 'xyz' }),
{ {
@ -45,7 +45,7 @@ server.listen(0, common.mustCall(() => {
message: `Header field "${i}" must only have a single value` message: `Header field "${i}" must only have a single value`
} }
); );
}); }
server.close(); server.close();
client.close(); client.close();