summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_http_agent.js1
-rw-r--r--test/parallel/test-http-agent-getname.js32
-rw-r--r--test/parallel/test-http-agent-keepalive.js2
3 files changed, 33 insertions, 2 deletions
diff --git a/lib/_http_agent.js b/lib/_http_agent.js
index 9208044a94..1db331c3d1 100644
--- a/lib/_http_agent.js
+++ b/lib/_http_agent.js
@@ -107,7 +107,6 @@ Agent.prototype.getName = function(options) {
name += ':';
if (options.localAddress)
name += options.localAddress;
- name += ':';
return name;
};
diff --git a/test/parallel/test-http-agent-getname.js b/test/parallel/test-http-agent-getname.js
new file mode 100644
index 0000000000..d8d30a8ddb
--- /dev/null
+++ b/test/parallel/test-http-agent-getname.js
@@ -0,0 +1,32 @@
+'use strict';
+
+var assert = require('assert');
+var http = require('http');
+var common = require('../common');
+
+var agent = new http.Agent();
+
+// default to localhost
+assert.equal(
+ agent.getName({
+ port: 80,
+ localAddress: '192.168.1.1'
+ }),
+ 'localhost:80:192.168.1.1'
+);
+
+// empty
+assert.equal(
+ agent.getName({}),
+ 'localhost::'
+);
+
+// pass all arguments
+assert.equal(
+ agent.getName({
+ host: '0.0.0.0',
+ port: 80,
+ localAddress: '192.168.1.1'
+ }),
+ '0.0.0.0:80:192.168.1.1'
+);
diff --git a/test/parallel/test-http-agent-keepalive.js b/test/parallel/test-http-agent-keepalive.js
index f82af380bc..ef9553c831 100644
--- a/test/parallel/test-http-agent-keepalive.js
+++ b/test/parallel/test-http-agent-keepalive.js
@@ -35,7 +35,7 @@ function get(path, callback) {
}, callback);
}
-var name = 'localhost:' + common.PORT + '::';
+var name = 'localhost:' + common.PORT + ':';
function checkDataAndSockets(body) {
assert.equal(body.toString(), 'hello world');