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 1b25008

Browse filesBrowse files
haramjtargos
authored andcommitted
http: improve writeEarlyHints by avoiding for-of loop
PR-URL: #59958 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 6529ae9 commit 1b25008
Copy full SHA for 1b25008

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/_http_server.js‎

Copy file name to clipboardExpand all lines: lib/_http_server.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ ServerResponse.prototype.writeEarlyHints = function writeEarlyHints(hints, cb) {
330330

331331
head += 'Link: ' + link + '\r\n';
332332

333-
for (const key of ObjectKeys(hints)) {
333+
const keys = ObjectKeys(hints);
334+
for (let i = 0; i < keys.length; i++) {
335+
const key = keys[i];
334336
if (key !== 'link') {
335337
head += key + ': ' + hints[key] + '\r\n';
336338
}

0 commit comments

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