http: improve for-loop readability in _http_outgoing.js
PR-URL: https://github.com/nodejs/node/pull/26408 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
ed465eb595
commit
4fb88cd888
@ -296,24 +296,24 @@ function _storeHeader(firstLine, headers) {
|
|||||||
header: firstLine
|
header: firstLine
|
||||||
};
|
};
|
||||||
|
|
||||||
var key;
|
if (headers) {
|
||||||
if (headers === this[outHeadersKey]) {
|
if (headers === this[outHeadersKey]) {
|
||||||
for (key in headers) {
|
for (const key in headers) {
|
||||||
const entry = headers[key];
|
const entry = headers[key];
|
||||||
processHeader(this, state, entry[0], entry[1], false);
|
processHeader(this, state, entry[0], entry[1], false);
|
||||||
}
|
}
|
||||||
} else if (Array.isArray(headers)) {
|
} else if (Array.isArray(headers)) {
|
||||||
for (var i = 0; i < headers.length; i++) {
|
for (const entry of headers) {
|
||||||
const entry = headers[i];
|
|
||||||
processHeader(this, state, entry[0], entry[1], true);
|
processHeader(this, state, entry[0], entry[1], true);
|
||||||
}
|
}
|
||||||
} else if (headers) {
|
} else {
|
||||||
for (key in headers) {
|
for (const key in headers) {
|
||||||
if (hasOwnProperty(headers, key)) {
|
if (hasOwnProperty(headers, key)) {
|
||||||
processHeader(this, state, key, headers[key], true);
|
processHeader(this, state, key, headers[key], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let { header } = state;
|
let { header } = state;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user