Skip to content

Commit

Permalink
Respect ports in JX.URI
Browse files Browse the repository at this point in the history
Summary: durrrrrp

Test Plan: My local install on 8080 works better now. New test passes.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3573
  • Loading branch information
epriestley committed Oct 1, 2012
1 parent cad107b commit f1de6ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/URI.js
Expand Up @@ -185,6 +185,10 @@ JX.install('URI', {
}
str += this.getDomain() || '';

if (this.getPort()) {
str += ':' + this.getPort();
}

// If there is a domain or a protocol, we need to provide '/' for the
// path. If we don't have either and also don't have a path, we can omit
// it to produce a partial URI without path information which begins
Expand Down
3 changes: 2 additions & 1 deletion src/lib/__tests__/URI.js
Expand Up @@ -4,9 +4,10 @@
describe('Javelin URI', function() {

it('should understand parts of a uri', function() {
var uri = JX.$U('http://www.facebook.com/home.php?key=value#fragment');
var uri = JX.$U('http://www.facebook.com:123/home.php?key=value#fragment');
expect(uri.getProtocol()).toEqual('http');
expect(uri.getDomain()).toEqual('www.facebook.com');
expect(uri.getPort()).toEqual('123');
expect(uri.getPath()).toEqual('/home.php');
expect(uri.getQueryParams()).toEqual({'key' : 'value'});
expect(uri.getFragment()).toEqual('fragment');
Expand Down

0 comments on commit f1de6ce

Please sign in to comment.