Skip to content

Commit 17e98e7

Browse files
committed
http: improve writeEarlyHints by avoiding for-of loop
1 parent 39d7303 commit 17e98e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/_http_server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ ServerResponse.prototype.writeEarlyHints = function writeEarlyHints(hints, cb) {
331331

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

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

0 commit comments

Comments
 (0)