mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
http: improve writeEarlyHints by avoiding for-of loop
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
0c1fb986a0
commit
5b3c4b37f6
|
|
@ -331,7 +331,9 @@ ServerResponse.prototype.writeEarlyHints = function writeEarlyHints(hints, cb) {
|
||||||
|
|
||||||
head += 'Link: ' + link + '\r\n';
|
head += 'Link: ' + link + '\r\n';
|
||||||
|
|
||||||
for (const key of ObjectKeys(hints)) {
|
const keys = ObjectKeys(hints);
|
||||||
|
for (let i = 0; i < keys.length; i++) {
|
||||||
|
const key = keys[i];
|
||||||
if (key !== 'link') {
|
if (key !== 'link') {
|
||||||
head += key + ': ' + hints[key] + '\r\n';
|
head += key + ': ' + hints[key] + '\r\n';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user