mirror of https://github.com/lukechilds/node.git
Browse Source
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>v4.0.0-rc
Brendan Ashworth
10 years ago
committed by
Rod Vagg
3 changed files with 33 additions and 2 deletions
@ -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' |
|||
); |
Loading…
Reference in new issue