trailingSlash: true does not work if there are query params
See original GitHub issueI’m having many issues with router5 when I use URLs with “query” parameters (not real URL query params, but those params after “?” after the URL fragment “#”).
My routes:
{
name : "foo",
path : "/:companyId"
}
Router options:
{
trailingSlash : true,
strictQueryParams : false
}
Then let’s open the web app directly with the following URLs:
https://localhost/#/microsoft
- It matches the
foo
route.
https://localhost/#/microsoft/
- It matches the
foo
route and rewrites the URL tohttps://localhost/#/microsoft
.
https://localhost/#/microsoft?qwe=123
- It matches the
foo
route.
https://localhost/#/microsoft/?qwe=123
- It does NOT match the
foo
route.
I’ve also tried adding “/” to the path
in the foo
route and also trailingSlash:false
. Nothing works.
Do I miss something? or is it just that router5 does not properly behave when there are “extra query params” in the initial URL?
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (7 by maintainers)
Top Results From Across the Web
Router is not resolving query param without trailing slash
Router is not resolving query param without trailing slash #23706. Open ... I need to use /foo/?myparam=test to make it work ...
Read more >OK to skip slash before query string? - Stack Overflow
As a matter of modern spec, yes, it is permissible to skip the slash, contrary to what the accepted answer here claims.
Read more >Location - Angular
Removes a trailing slash from a URL string if needed. Looks for the first occurrence of either # , ? , or the...
Read more >APPEND_SLASH doesn't work with URLs that have query ...
It is because: request.get_full_path().endswith('/') checks also query string and therefore returns true and the slash is never appended.
Read more >next/router | Next.js
Therefore, basePath , locale and trailing slash ( trailingSlash: true ) are not included. query : Object - The query string parsed to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I hope this clearly shows the problem:
https://github.com/ibc/router5-url-issue
Hi, the issue still exists in 6.1.3