Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a38ad07

Browse filesBrowse files
rchouguledanielleadams
authored andcommitted
http2: refactor to use primordials instead of <string>.indexOf
PR-URL: #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>
1 parent 7c7180a commit a38ad07
Copy full SHA for a38ad07

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎lib/internal/http2/compat.js‎

Copy file name to clipboardExpand all lines: lib/internal/http2/compat.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const {
1111
ObjectPrototypeHasOwnProperty,
1212
ReflectApply,
1313
ReflectGetPrototypeOf,
14+
StringPrototypeIncludes,
1415
StringPrototypeToLowerCase,
1516
StringPrototypeTrim,
1617
Symbol,
@@ -81,7 +82,9 @@ let statusConnectionHeaderWarned = false;
8182
// close as possible to the current require('http') API
8283

8384
const assertValidHeader = hideStackFrames((name, value) => {
84-
if (name === '' || typeof name !== 'string' || name.indexOf(' ') >= 0) {
85+
if (name === '' ||
86+
typeof name !== 'string' ||
87+
StringPrototypeIncludes(name, ' ')) {
8588
throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
8689
}
8790
if (isPseudoHeader(name)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.