Skip to content

Commit 5cb6500

Browse files
apapirovskiMylesBorins
authored andcommitted
test: increase coverage for http2 response headers
Expanded an existing test for setting pseudo-headers on response to include all pseudo-headers, not just :status. PR-URL: #15035 Refs: #14985 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent ebb3c2c commit 5cb6500

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

test/parallel/test-http2-compat-serverresponse-headers.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,20 @@ server.listen(0, common.mustCall(function() {
4242
response.removeHeader(denormalised);
4343
assert.strictEqual(response.hasHeader(denormalised), false);
4444

45-
assert.throws(function() {
46-
response.setHeader(':status', 'foobar');
47-
}, common.expectsError({
48-
code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
49-
type: Error,
50-
message: 'Cannot set HTTP/2 pseudo-headers'
51-
}));
45+
[
46+
':status',
47+
':method',
48+
':path',
49+
':authority',
50+
':scheme'
51+
].forEach((header) => assert.throws(
52+
() => response.setHeader(header, 'foobar'),
53+
common.expectsError({
54+
code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
55+
type: Error,
56+
message: 'Cannot set HTTP/2 pseudo-headers'
57+
})
58+
));
5259
assert.throws(function() {
5360
response.setHeader(real, null);
5461
}, common.expectsError({

0 commit comments

Comments
 (0)