|
@ -97,9 +97,7 @@ function ClientRequest(options, cb) { |
|
|
var port = options.port = options.port || defaultPort || 80; |
|
|
var port = options.port = options.port || defaultPort || 80; |
|
|
var host = options.host = options.hostname || options.host || 'localhost'; |
|
|
var host = options.host = options.hostname || options.host || 'localhost'; |
|
|
|
|
|
|
|
|
if (options.setHost === undefined) { |
|
|
var setHost = (options.setHost === undefined); |
|
|
var setHost = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self.socketPath = options.socketPath; |
|
|
self.socketPath = options.socketPath; |
|
|
self.timeout = options.timeout; |
|
|
self.timeout = options.timeout; |
|
@ -128,7 +126,7 @@ function ClientRequest(options, cb) { |
|
|
if (!headersArray) { |
|
|
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; i < keys.length; i++) { |
|
|
var key = keys[i]; |
|
|
var key = keys[i]; |
|
|
self.setHeader(key, options.headers[key]); |
|
|
self.setHeader(key, options.headers[key]); |
|
|
} |
|
|
} |
|
@ -154,7 +152,6 @@ function ClientRequest(options, cb) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (options.auth && !this.getHeader('Authorization')) { |
|
|
if (options.auth && !this.getHeader('Authorization')) { |
|
|
//basic auth
|
|
|
|
|
|
this.setHeader('Authorization', 'Basic ' + |
|
|
this.setHeader('Authorization', 'Basic ' + |
|
|
Buffer.from(options.auth).toString('base64')); |
|
|
Buffer.from(options.auth).toString('base64')); |
|
|
} |
|
|
} |
|
|