diff --git a/lib/internal/errors.js b/lib/internal/errors.js index f09bf973efc02a..27db4eb573f3d9 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -728,15 +728,12 @@ E('ERR_HTTP2_GOAWAY_SESSION', E('ERR_HTTP2_HEADERS_AFTER_RESPOND', 'Cannot specify additional headers after response initiated', Error); E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error); - E('ERR_HTTP2_HEADER_SINGLE_VALUE', 'Header field "%s" must only have a single value', TypeError); E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', 'Informational status codes cannot be used', RangeError); - -// This should probably be a `TypeError`. E('ERR_HTTP2_INVALID_CONNECTION_HEADERS', - 'HTTP/1 Connection specific headers are forbidden: "%s"', Error); + 'HTTP/1 Connection specific headers are forbidden: "%s"', TypeError); E('ERR_HTTP2_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP2_INVALID_INFO_STATUS', diff --git a/test/parallel/test-http2-server-push-stream-errors-args.js b/test/parallel/test-http2-server-push-stream-errors-args.js index f752f44310c0df..24f7c9fcef9342 100644 --- a/test/parallel/test-http2-server-push-stream-errors-args.js +++ b/test/parallel/test-http2-server-push-stream-errors-args.js @@ -31,6 +31,7 @@ server.on('stream', common.mustCall((stream, headers) => { () => stream.pushStream({ 'connection': 'test' }, {}, () => {}), { code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS', + name: 'TypeError [ERR_HTTP2_INVALID_CONNECTION_HEADERS]', message: 'HTTP/1 Connection specific headers are forbidden: "connection"' } ); diff --git a/test/parallel/test-http2-util-headers-list.js b/test/parallel/test-http2-util-headers-list.js index 0e5c519264de7b..772e9c8679feef 100644 --- a/test/parallel/test-http2-util-headers-list.js +++ b/test/parallel/test-http2-util-headers-list.js @@ -283,6 +283,7 @@ const { ].forEach((name) => { common.expectsError({ code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS', + name: 'TypeError [ERR_HTTP2_INVALID_CONNECTION_HEADERS]', message: 'HTTP/1 Connection specific headers are forbidden: ' + `"${name.toLowerCase()}"` })(mapToHeaders({ [name]: 'abc' })); @@ -290,12 +291,14 @@ const { common.expectsError({ code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS', + name: 'TypeError [ERR_HTTP2_INVALID_CONNECTION_HEADERS]', message: 'HTTP/1 Connection specific headers are forbidden: ' + `"${HTTP2_HEADER_TE}"` })(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc'] })); common.expectsError({ code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS', + name: 'TypeError [ERR_HTTP2_INVALID_CONNECTION_HEADERS]', message: 'HTTP/1 Connection specific headers are forbidden: ' + `"${HTTP2_HEADER_TE}"` })(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc', 'trailers'] }));