Closed rapodaca closed 2 years ago
That's correct! We model somewhat after express here, in that /route/ == /route
in terms of matching. This is something I could update though, is there a use case you're after?
I'm not sure the current behavior is correct. See these two items:
Bottom line: treating /foo/
and /foo
as synonyms for the same resource can interfere with the use of relative URLs. A redirect, which can be applied as a top-level middleware by those users who want it, solves the problem without introducing another. At least that's my understanding.
I'm not sure I fully agree with some of the points in that article, but I do fully agree that it should be the developer's choice. I'll work on adding a configuration for it! Thanks for raising the issue :-)
On Thu, Sep 9, 2021, 9:35 AM Richard Apodaca @.***> wrote:
I'm not sure the current behavior is correct. See these two items:
- OK to skip slash before query string? https://stackoverflow.com/questions/13442377/redirect-all-trailing-slashes-globally-in-express/43948185
- Why trailing slashes on URIs are important https://cdivilly.wordpress.com/2014/03/11/why-trailing-slashes-on-uris-are-important/
Bottom line: treating /foo/ and /foo as synonyms for the same resource can interfere with the use of relative URLs. A redirect, which can be applied as a top-level middleware by those users who want it, solves the problem without introducing another. At least that's my understanding.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thruster-rs/Thruster/issues/196#issuecomment-916104227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWOLL5RULR4TJHQMY2L4DUBCZZTANCNFSM5DWFCYOQ .
It looks like this has been resolved in v1.1.10. Looking forward to trying it out!
An example taken from the examples directory:
I expect
/plaintext
to match and it does. But/plaintext/
also matches, which is unexpected.If I change the route to
/plaintext/
, then '/plaintext` matches, which I also didn't expect. I looked for this in documentation, an even source, but couldn't find anything.Is the trailing slash matching part of Thruster, or one of the underlying libraries? What should be the supported behavior?