errors: change ERR_HTTP2_HEADER_SINGLE_VALUE to TypeError
changes the base instance for ERR_HTTP2_HEADER_SINGLE_VALUE from Error to TypeError as a more accurate representation of the error. Additionally corrects the grammar of the error message. PR-URL: https://github.com/nodejs/node/pull/19805 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
add1c02bda
commit
ef07d6570f
@ -718,9 +718,8 @@ E('ERR_HTTP2_HEADERS_AFTER_RESPOND',
|
|||||||
'Cannot specify additional headers after response initiated', Error);
|
'Cannot specify additional headers after response initiated', Error);
|
||||||
E('ERR_HTTP2_HEADERS_SENT', 'Response has already been 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',
|
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',
|
E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED',
|
||||||
'Informational status codes cannot be used', RangeError);
|
'Informational status codes cannot be used', RangeError);
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ server.listen(0, common.mustCall(() => {
|
|||||||
});
|
});
|
||||||
}, {
|
}, {
|
||||||
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
||||||
type: Error,
|
type: TypeError,
|
||||||
message: 'Header field "content-length" must have only a single value'
|
message: 'Header field "content-length" must only have a single value'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ server.listen(0, common.mustCall(() => {
|
|||||||
() => client.request({ [i]: 'abc', [i.toUpperCase()]: 'xyz' }),
|
() => client.request({ [i]: 'abc', [i.toUpperCase()]: 'xyz' }),
|
||||||
{
|
{
|
||||||
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
||||||
type: Error,
|
type: TypeError,
|
||||||
message: `Header field "${i}" must have only a single value`
|
message: `Header field "${i}" must only have a single value`
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ server.listen(0, common.mustCall(() => {
|
|||||||
() => client.request({ [i]: ['abc', 'xyz'] }),
|
() => client.request({ [i]: ['abc', 'xyz'] }),
|
||||||
{
|
{
|
||||||
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
||||||
type: Error,
|
type: TypeError,
|
||||||
message: `Header field "${i}" must have only a single value`
|
message: `Header field "${i}" must only have a single value`
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -177,8 +177,8 @@ const {
|
|||||||
|
|
||||||
common.expectsError({
|
common.expectsError({
|
||||||
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
||||||
type: Error,
|
type: TypeError,
|
||||||
message: 'Header field ":status" must have only a single value'
|
message: 'Header field ":status" must only have a single value'
|
||||||
})(mapToHeaders(headers));
|
})(mapToHeaders(headers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ const {
|
|||||||
HTTP2_HEADER_USER_AGENT,
|
HTTP2_HEADER_USER_AGENT,
|
||||||
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS
|
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS
|
||||||
].forEach((name) => {
|
].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({
|
common.expectsError({
|
||||||
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
|
||||||
message: msg
|
message: msg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user