mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
5897bf4621
commit
bf7a52b764
1 file changed
+15
-15
+15
-15
@@ -295,21 +295,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user