Skip to content

Commit

Permalink
improving hostname support.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Jul 13, 2017
1 parent 2083306 commit 3340e76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "connection-string",
"version": "0.1.0",
"version": "0.1.1",
"description": "URL Connection String Parser.",
"main": "src/index.js",
"typings": "src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
m = cs.match(/(\[([0-9a-z:%]{2,45})](?::([0-9]+))?)/);
} else {
// It is either IPv4 or a name
m = cs.match(/(([^:/?[]*)(?::([0-9]+))?)/);
m = cs.match(/(([\w-.]*)(?::([0-9]+))?)/);
}

if (m) {
Expand Down
6 changes: 3 additions & 3 deletions test/mainSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ describe('host', function () {
hostname: 'server'
});
});
it('must not decode URL characters', function () {
it('must not allow URL characters', function () {
expect(parse('server%20')).toEqual({
host: 'server%20',
hostname: 'server%20'
host: 'server',
hostname: 'server'
});
});
it('must allow IPv4 addresses', function () {
Expand Down

0 comments on commit 3340e76

Please sign in to comment.