Skip to content

Commit

Permalink
http: avoid duplicate isArray()
Browse files Browse the repository at this point in the history
PR-URL: #10654
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Fedor Indutny <[email protected]>
  • Loading branch information
mscdex committed Jan 19, 2017
1 parent e7859c2 commit 44c0e4f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ function ClientRequest(options, cb) {
self.once('response', cb);
}

if (!Array.isArray(options.headers)) {
var headersArray = Array.isArray(options.headers);
if (!headersArray) {
if (options.headers) {
var keys = Object.keys(options.headers);
for (var i = 0, l = keys.length; i < l; i++) {
Expand Down Expand Up @@ -166,7 +167,7 @@ function ClientRequest(options, cb) {
self.useChunkedEncodingByDefault = true;
}

if (Array.isArray(options.headers)) {
if (headersArray) {
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
options.headers);
} else if (self.getHeader('expect')) {
Expand Down

0 comments on commit 44c0e4f

Please sign in to comment.