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>
This commit is contained in:
parent
dab22b5b7a
commit
15c6187aa5
@ -124,7 +124,8 @@ function ClientRequest(options, cb) {
|
|||||||
self.once('response', cb);
|
self.once('response', cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(options.headers)) {
|
var headersArray = Array.isArray(options.headers);
|
||||||
|
if (!headersArray) {
|
||||||
if (options.headers) {
|
if (options.headers) {
|
||||||
var keys = Object.keys(options.headers);
|
var keys = Object.keys(options.headers);
|
||||||
for (var i = 0, l = keys.length; i < l; i++) {
|
for (var i = 0, l = keys.length; i < l; i++) {
|
||||||
@ -168,7 +169,7 @@ function ClientRequest(options, cb) {
|
|||||||
self.useChunkedEncodingByDefault = true;
|
self.useChunkedEncodingByDefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(options.headers)) {
|
if (headersArray) {
|
||||||
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
|
self._storeHeader(self.method + ' ' + self.path + ' HTTP/1.1\r\n',
|
||||||
options.headers);
|
options.headers);
|
||||||
} else if (self.getHeader('expect')) {
|
} else if (self.getHeader('expect')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user