Browse Source

http: avoid duplicate isArray()

PR-URL: https://github.com/nodejs/node/pull/10654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
v7.x
Brian White 8 years ago
parent
commit
44c0e4f1ad
No known key found for this signature in database GPG Key ID: 606D7358F94DA209
  1. 5
      lib/_http_client.js

5
lib/_http_client.js

@ -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++) {
@ -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')) {

Loading…
Cancel
Save