mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
2965442308
This commit fixes agent.getName(), which returned an extra colon according to the docs, and adds tests (it was previously not unit tested). PR-URL: https://github.com/nodejs/io.js/pull/1617 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
33 lines
504 B
JavaScript
33 lines
504 B
JavaScript
'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'
|
|
);
|