Skip to content

Commit

Permalink
http: improve for-loop readability in _http_outgoing.js
Browse files Browse the repository at this point in the history
PR-URL: #26408
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
gengjiawen authored and BridgeAR committed Mar 13, 2019
1 parent cae30d9 commit f7ecc94
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit f7ecc94

Please sign in to comment.