From 431bf74c5550a7c15ada1d99b4b1bdefd6bbb86b Mon Sep 17 00:00:00 2001 From: Malcolm Ahoy Date: Fri, 11 Sep 2015 14:18:01 -0700 Subject: [PATCH] http: default Agent.getName to 'localhost' Refactor out the if/else statement checking for option.host. Add whitespace to make concatenation chunks more readable and consistent with the https version of Agent.getName(). PR-URL: https://github.com/nodejs/node/pull/2825 Reviewed-By: Julian Duque Reviewed-By: Rich Trott --- lib/_http_agent.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 1db331c..c18f39a 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -94,19 +94,16 @@ Agent.prototype.createConnection = net.createConnection; // Get the key for a given set of request options Agent.prototype.getName = function(options) { - var name = ''; - - if (options.host) - name += options.host; - else - name += 'localhost'; + var name = options.host || 'localhost'; name += ':'; if (options.port) name += options.port; + name += ':'; if (options.localAddress) name += options.localAddress; + return name; }; -- 2.7.4