Closed jotto closed 6 years ago
Not sure. Removing trailing slash with a query string is not always a safe change.
For example, https://sindresorhus.com/feedback/?foo works, but https://sindresorhus.com/feedback?foo does not.
They aren't the same thing. If I'm not mistaken, some REST APIs tend to use /resource/
to get a list of the resources and /resource
to get one resource.
This might be a case-by-case thing. Based on @SamVerschueren's observation, the existing functionality might be wrong too:
> normalizeUrl('example.com/index/')
'http://example.com/index'
If the server is...
/dir-or-file/
is the same as /dir-or-file
and can't co-exist (and the trailing slash normalization seems correct)/dir-or-file/
could be different than /dir-or-file
and you can't normalize a trailing slash (because you don't know if it's different or not)Removing a trailing slash regardless of a query is not always safe, as pointed out by @jotto. This library is already opinionated in regards to what is safe, though, so you may not always want the default settings.
Right now it looks like a normalization bug, unless these are in fact 2 different URLs: