Skip to content

Commit 64f5527

Browse files
fixed pathname bug for very weird urls
1 parent 8840d89 commit 64f5527

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/parsers/postman/v2.0/Parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ methods.addHostEntryToHostMap = (hostMap, { key, value }) => {
478478
const hostname = key.get('hostname') ? key.get('hostname').generate(List([ '{{', '}}' ])) : ''
479479
const port = key.get('port') ? ':' + key.get('port').generate(List([ '{{', '}}' ])) : ''
480480
const host = hostname + port
481-
const pathname = key.get('pathname').generate(List([ '{{', '}}' ]))
481+
const pathname = key.get('pathname') ? key.get('pathname').generate(List([ '{{', '}}' ])) : ''
482482

483483
if (!hostMap[host]) {
484484
hostMap[host] = { entries: [], lcPathname: pathname.split('/') }

src/parsers/postman/v2.0/__tests__/Parser.spec.js

+19
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,13 @@ describe('parsers/postman/v2.0/Parser.js', () => {
960960
variableDelimiters: List([ '{{', '}}', ':' ])
961961
}),
962962
value: 321
963+
},
964+
{
965+
key: new URL({
966+
url: 'staging.paw.cloud',
967+
variableDelimiters: List([ '{{', '}}', ':' ])
968+
}),
969+
value: 123
963970
}
964971
]
965972
const expected = {
@@ -1017,6 +1024,18 @@ describe('parsers/postman/v2.0/Parser.js', () => {
10171024
}
10181025
],
10191026
lcPathname: [ '', 'users', '321' ]
1027+
},
1028+
'staging.paw.cloud': {
1029+
entries: [
1030+
{
1031+
key: new URL({
1032+
url: 'staging.paw.cloud',
1033+
variableDelimiters: List([ '{{', '}}', ':' ])
1034+
}),
1035+
value: 123
1036+
}
1037+
],
1038+
lcPathname: [ '' ]
10201039
}
10211040
}
10221041

0 commit comments

Comments
 (0)