mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
http: misc ClientRequest cleanup
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:
1 file changed
+2
-5
+2
-5
@@ -95,9 +95,7 @@ function ClientRequest(options, cb) {
|
||||
var port = options.port = options.port || defaultPort || 80;
|
||||
var host = options.host = options.hostname || options.host || 'localhost';
|
||||
|
||||
if (options.setHost === undefined) {
|
||||
var setHost = true;
|
||||
}
|
||||
var setHost = (options.setHost === undefined);
|
||||
|
||||
self.socketPath = options.socketPath;
|
||||
self.timeout = options.timeout;
|
||||
@@ -126,7 +124,7 @@ function ClientRequest(options, cb) {
|
||||
if (!headersArray) {
|
||||
if (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];
|
||||
self.setHeader(key, options.headers[key]);
|
||||
}
|
||||
@@ -152,7 +150,6 @@ function ClientRequest(options, cb) {
|
||||
}
|
||||
|
||||
if (options.auth && !this.getHeader('Authorization')) {
|
||||
//basic auth
|
||||
this.setHeader('Authorization', 'Basic ' +
|
||||
Buffer.from(options.auth).toString('base64'));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user