From 2f7759640ea7177d0bceb6f7aa68494c9ad1f2c1 Mon Sep 17 00:00:00 2001 From: Brian White Date: Fri, 6 Jan 2017 03:13:57 -0500 Subject: [PATCH] http: misc ClientRequest cleanup PR-URL: https://github.com/nodejs/node/pull/10654 Reviewed-By: James M Snell Reviewed-By: Fedor Indutny --- lib/_http_client.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 791a86e76b45cf..d28481a67407c5 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -97,9 +97,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; @@ -128,7 +126,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]); } @@ -154,7 +152,6 @@ function ClientRequest(options, cb) { } if (options.auth && !this.getHeader('Authorization')) { - //basic auth this.setHeader('Authorization', 'Basic ' + Buffer.from(options.auth).toString('base64')); }