Skip to content

Commit

Permalink
Merge pull request #25 from GoogleChromeLabs/export
Browse files Browse the repository at this point in the history
Fixes #24
  • Loading branch information
janicklas-ralph authored Apr 5, 2020
2 parents 122ea21 + 63bde05 commit f2d5128
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"test:browser": "karmatic",
"test:node": "jest",
"pretest": "yarn run build",
"test": "jest && karmatic"
"test": "jest && karmatic",
"release": "release-it"
},
"author": "Janicklas Ralph",
"license": "Apache-2.0",
Expand Down
18 changes: 18 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ describe('Basic parse and format:', () => {
});
});

parseTestsWithQueryString = {
...parseTestsWithQueryString,
'/example?query=size:10': {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null,
search: '?query=size:10',
query: { query: 'size:10' },
pathname: '/example',
path: '/example?query=size:10',
href: '/example?query=size:10',
},
};

describe('With querystring:', () => {
Object.keys(parseTestsWithQueryString).forEach(function (u) {
it(`parse(${u}):`, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function (urlStr, parseQs = false, slashesDenoteHost = false) {
}

// If port is 80 we change it to 8000 and undo it later
let portMatch = urlStr.match(/(:[0-9]+)/);
let portMatch = (slashesMatch ? slashesMatch[1] : urlStr).match(/(:[0-9]+)/);
let portSuffix = '';

if (portMatch && portMatch[1] && portMatch[1].length === 3) {
Expand Down

0 comments on commit f2d5128

Please sign in to comment.