Closed ramaralo closed 5 years ago
When the URL contains a # and # is before query parameters, the query property returns empty : query: {}.
#
query
query: {}
This test should pass:
describe('when # is before query params', function () { it('extracts query correctly', function () { const parsed = parse('https://www.google.com/#/some/path?param1=one', true); const expected = { slashes: true, protocol: 'https:', hash: '#/some/path?param1=one', query: { param1: 'one' }, pathname: '/', auth: '', host: 'www.google.com', port: '', hostname: 'www.google.com', password: '', username: '', origin: 'https://www.google.com', href: 'https://www.google.com/#/some/path?param1=one' }; assume(parsed).eql(expected); })});
Not sure if hash should be hash: '#/some/path?param1=one' or hash: '#/some/path' though.
hash
hash: '#/some/path?param1=one'
hash: '#/some/path'
I'm sorry that is simply not how URL's work. The query in your example is part of the hash. If you want to parse it out, you should run a querystring parser over the resulting hash.
When the URL contains a
#
and#
is before query parameters, thequery
property returns empty :query: {}
.This test should pass:
Not sure if
hash
should behash: '#/some/path?param1=one'
orhash: '#/some/path'
though.