-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] Handle the case where the port is specified but empty
- Loading branch information
Showing
2 changed files
with
32 additions
and
3 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 |
---|---|---|
|
@@ -442,6 +442,28 @@ describe('url-parse', function () { | |
assume(parsed.href).equals('sip:[email protected]'); | ||
}); | ||
|
||
it('handles the case where the port is specified but empty', function () { | ||
var parsed = parse('http://example.com:'); | ||
|
||
assume(parsed.protocol).equals('http:'); | ||
assume(parsed.port).equals(''); | ||
assume(parsed.host).equals('example.com'); | ||
assume(parsed.hostname).equals('example.com'); | ||
assume(parsed.pathname).equals('/'); | ||
assume(parsed.origin).equals('http://example.com'); | ||
assume(parsed.href).equals('http://example.com/'); | ||
|
||
parsed = parse('http://example.com::'); | ||
|
||
assume(parsed.protocol).equals('http:'); | ||
assume(parsed.port).equals(''); | ||
assume(parsed.host).equals('example.com:'); | ||
assume(parsed.hostname).equals('example.com:'); | ||
assume(parsed.pathname).equals('/'); | ||
assume(parsed.origin).equals('http://example.com:'); | ||
assume(parsed.href).equals('http://example.com::/'); | ||
}); | ||
|
||
describe('origin', function () { | ||
it('generates an origin property', function () { | ||
var url = 'http://google.com:80/pathname' | ||
|