-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: fix agent.getName() and add tests
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: #1617 Reviewed-By: Ben Noordhuis <[email protected]>
- Loading branch information
1 parent
4cffaa3
commit 2965442
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters