Skip to content

Commit

Permalink
http: avoid duplicate isArray()
Browse files Browse the repository at this point in the history
PR-URL: nodejs#10654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
  • Loading branch information
mscdex authored and italoacasas committed Jan 23, 2017
1 parent 7d45581 commit 072e53b
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 @@ -113,7 +113,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 @@ -157,7 +158,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 072e53b

Please sign in to comment.