Skip to content

Commit 15c6187

Browse files
committed
http: avoid duplicate isArray()
PR-URL: #10654 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent dab22b5 commit 15c6187

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/_http_client.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ function ClientRequest(options, cb) {
124124
self.once('response', cb);
125125
}
126126

127-
if (!Array.isArray(options.headers)) {
127+
var headersArray = Array.isArray(options.headers);
128+
if (!headersArray) {
128129
if (options.headers) {
129130
var keys = Object.keys(options.headers);
130131
for (var i = 0, l = keys.length; i < l; i++) {
@@ -168,7 +169,7 @@ function ClientRequest(options, cb) {
168169
self.useChunkedEncodingByDefault = true;
169170
}
170171

171-
if (Array.isArray(options.headers)) {
172+
if (headersArray) {
172173
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
173174
options.headers);
174175
} else if (self.getHeader('expect')) {

0 commit comments

Comments
 (0)