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 <julianduquej@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
e7a3ca3d31
commit
7d7941235a
@ -94,19 +94,16 @@ Agent.prototype.createConnection = net.createConnection;
|
|||||||
|
|
||||||
// Get the key for a given set of request options
|
// Get the key for a given set of request options
|
||||||
Agent.prototype.getName = function(options) {
|
Agent.prototype.getName = function(options) {
|
||||||
var name = '';
|
var name = options.host || 'localhost';
|
||||||
|
|
||||||
if (options.host)
|
|
||||||
name += options.host;
|
|
||||||
else
|
|
||||||
name += 'localhost';
|
|
||||||
|
|
||||||
name += ':';
|
name += ':';
|
||||||
if (options.port)
|
if (options.port)
|
||||||
name += options.port;
|
name += options.port;
|
||||||
|
|
||||||
name += ':';
|
name += ':';
|
||||||
if (options.localAddress)
|
if (options.localAddress)
|
||||||
name += options.localAddress;
|
name += options.localAddress;
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user