mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
http2: refactor to use primordials instead of <string>.indexOf
PR-URL: https://github.com/nodejs/node/pull/36679 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
e68299a8f7
commit
3af175fb5e
1 file changed
+4
-1
@@ -11,6 +11,7 @@ const {
|
||||
ObjectPrototypeHasOwnProperty,
|
||||
ReflectApply,
|
||||
ReflectGetPrototypeOf,
|
||||
StringPrototypeIncludes,
|
||||
StringPrototypeToLowerCase,
|
||||
StringPrototypeTrim,
|
||||
Symbol,
|
||||
@@ -81,7 +82,9 @@ let statusConnectionHeaderWarned = false;
|
||||
// close as possible to the current require('http') API
|
||||
|
||||
const assertValidHeader = hideStackFrames((name, value) => {
|
||||
if (name === '' || typeof name !== 'string' || name.indexOf(' ') >= 0) {
|
||||
if (name === '' ||
|
||||
typeof name !== 'string' ||
|
||||
StringPrototypeIncludes(name, ' ')) {
|
||||
throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
|
||||
}
|
||||
if (isPseudoHeader(name)) {
|
||||
|
||||
Reference in new issue
Block a user