You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When query parameters are specified in the path pattern, it does not match paths that omit all query parameters
import { Path } from 'path-parser';
const path = new Path('/foo?:bar');
// Returns {bar: 1} as expected
console.log(path.test('/foo?bar=1'));
// Fails to match, returns null. I expect this to return {foo: undefined}
console.log(path.test('/foo'));
Seems like the reason this is happening is that the full path is passed into search-string for query param parsing (
). For path /foo, search-string will try to interpret /foo as a query param key, and end up returning {'/foo': null}. This causes path matching to fail, because /foo is an unexpected key
The text was updated successfully, but these errors were encountered:
When query parameters are specified in the path pattern, it does not match paths that omit all query parameters
Seems like the reason this is happening is that the full path is passed into
search-string
for query param parsing (path-parser/src/Path.ts
Line 187 in 2ee0233
/foo
,search-string
will try to interpret/foo
as a query param key, and end up returning{'/foo': null}
. This causes path matching to fail, because/foo
is an unexpected keyThe text was updated successfully, but these errors were encountered: