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,21 +296,21 @@ function _storeHeader(firstLine, headers) {
|
||||
header: firstLine
|
||||
};
|
||||
|
||||
var key;
|
||||
if (headers === this[outHeadersKey]) {
|
||||
for (key in headers) {
|
||||
const entry = headers[key];
|
||||
processHeader(this, state, entry[0], entry[1], false);
|
||||
}
|
||||
} else if (Array.isArray(headers)) {
|
||||
for (var i = 0; i < headers.length; i++) {
|
||||
const entry = headers[i];
|
||||
processHeader(this, state, entry[0], entry[1], true);
|
||||
}
|
||||
} else if (headers) {
|
||||
for (key in headers) {
|
||||
if (hasOwnProperty(headers, key)) {
|
||||
processHeader(this, state, key, headers[key], true);
|
||||
if (headers) {
|
||||
if (headers === this[outHeadersKey]) {
|
||||
for (const key in headers) {
|
||||
const entry = headers[key];
|
||||
processHeader(this, state, entry[0], entry[1], false);
|
||||
}
|
||||
} else if (Array.isArray(headers)) {
|
||||
for (const entry of headers) {
|
||||
processHeader(this, state, entry[0], entry[1], true);
|
||||
}
|
||||
} else {
|
||||
for (const key in headers) {
|
||||
if (hasOwnProperty(headers, key)) {
|
||||
processHeader(this, state, key, headers[key], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user