Skip to content

Commit

Permalink
http: default Agent.getName to 'localhost'
Browse files Browse the repository at this point in the history
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: #2825
Reviewed-By: Julian Duque <julianduquej@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
ahoym authored and Trott committed Sep 15, 2015
1 parent e7a3ca3 commit 7d79412
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 7d79412

Please sign in to comment.