-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify some subtleties of routing #2896
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, docs improvements are super welcome.
I'm not convinced it's completely correct though, see review comment below.
Also, sorry for the lag.
paths `/foo` or `/foo/`, a nested router at `/foo` will match the path `/foo` | ||
(but not `/foo/`), and a nested router at `/foo/` will match the path `/foo/` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm skeptical about a different bit here: A nested router at /foo
will not match /foo/
(first parenthesis)? I'm pretty sure that's not right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn’t you open #2659 which explains this behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely forgot 🫠
Guess I am still of the same opinion, this is super confusing and should be changed. Makes it even more important to have clear docs!
Motivation
I was confused when using Axum of the following things:
nest("/foo")
will match/foo
and/or/foo/
;fallback
is called when the method is not allowed.Solution
Document the behaviours.
Also relevant: #2659, #2251