diff --git a/lib/internal/errors.js b/lib/internal/errors.js index f7c444afb23..99ffb46783b 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -718,9 +718,8 @@ 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); -// This should probably be a `TypeError`. E('ERR_HTTP2_HEADER_SINGLE_VALUE', - 'Header field "%s" must have only a single value', Error); + 'Header field "%s" must only have a single value', TypeError); E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', 'Informational status codes cannot be used', RangeError); diff --git a/test/parallel/test-http2-multi-content-length.js b/test/parallel/test-http2-multi-content-length.js index c64b803a0ec..7d8ff4858fe 100644 --- a/test/parallel/test-http2-multi-content-length.js +++ b/test/parallel/test-http2-multi-content-length.js @@ -31,8 +31,8 @@ server.listen(0, common.mustCall(() => { }); }, { code: 'ERR_HTTP2_HEADER_SINGLE_VALUE', - type: Error, - message: 'Header field "content-length" must have only a single value' + type: TypeError, + message: 'Header field "content-length" must only have a single value' } ); diff --git a/test/parallel/test-http2-single-headers.js b/test/parallel/test-http2-single-headers.js index c545b065015..37eaf8b17c8 100644 --- a/test/parallel/test-http2-single-headers.js +++ b/test/parallel/test-http2-single-headers.js @@ -31,8 +31,8 @@ server.listen(0, common.mustCall(() => { () => client.request({ [i]: 'abc', [i.toUpperCase()]: 'xyz' }), { code: 'ERR_HTTP2_HEADER_SINGLE_VALUE', - type: Error, - message: `Header field "${i}" must have only a single value` + type: TypeError, + message: `Header field "${i}" must only have a single value` } ); @@ -40,8 +40,8 @@ server.listen(0, common.mustCall(() => { () => client.request({ [i]: ['abc', 'xyz'] }), { code: 'ERR_HTTP2_HEADER_SINGLE_VALUE', - type: Error, - message: `Header field "${i}" must have only a single value` + type: TypeError, + message: `Header field "${i}" must only have a single value` } ); }); diff --git a/test/parallel/test-http2-util-headers-list.js b/test/parallel/test-http2-util-headers-list.js index 0ff6b558d9a..0e5c519264d 100644 --- a/test/parallel/test-http2-util-headers-list.js +++ b/test/parallel/test-http2-util-headers-list.js @@ -177,8 +177,8 @@ const { common.expectsError({ code: 'ERR_HTTP2_HEADER_SINGLE_VALUE', - type: Error, - message: 'Header field ":status" must have only a single value' + type: TypeError, + message: 'Header field ":status" must only have a single value' })(mapToHeaders(headers)); } @@ -223,7 +223,7 @@ const { HTTP2_HEADER_USER_AGENT, HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS ].forEach((name) => { - const msg = `Header field "${name}" must have only a single value`; + const msg = `Header field "${name}" must only have a single value`; common.expectsError({ code: 'ERR_HTTP2_HEADER_SINGLE_VALUE', message: msg