Browse Source

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: https://github.com/nodejs/node/pull/15035
Refs: https://github.com/nodejs/node/issues/14985
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
canary-base
Anatoli Papirovski 8 years ago
committed by Ruben Bridgewater
parent
commit
3eb029794c
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 21
      test/parallel/test-http2-compat-serverresponse-headers.js

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

@ -42,13 +42,20 @@ server.listen(0, common.mustCall(function() {
response.removeHeader(denormalised);
assert.strictEqual(response.hasHeader(denormalised), false);
assert.throws(function() {
response.setHeader(':status', 'foobar');
}, common.expectsError({
code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
type: Error,
message: 'Cannot set HTTP/2 pseudo-headers'
}));
[
':status',
':method',
':path',
':authority',
':scheme'
].forEach((header) => assert.throws(
() => response.setHeader(header, 'foobar'),
common.expectsError({
code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
type: Error,
message: 'Cannot set HTTP/2 pseudo-headers'
})
));
assert.throws(function() {
response.setHeader(real, null);
}, common.expectsError({

Loading…
Cancel
Save