Skip to content
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

Merged
merged 1 commit into from
Sep 22, 2024
Merged

Conversation

SabrinaJewson
Copy link
Contributor

Motivation

I was confused when using Axum of the following things:

  • whether nest("/foo") will match /foo and/or /foo/;
  • whether a fallback is called when the method is not allowed.

Solution

Document the behaviours.


Also relevant: #2659, #2251

Copy link
Member

@jplatte jplatte left a 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.

Comment on lines +86 to +87
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/`
Copy link
Member

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.

Copy link
Contributor Author

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?
ts
nots

Copy link
Member

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!

@jplatte jplatte merged commit 068c9a3 into tokio-rs:main Sep 22, 2024
18 checks passed
@SabrinaJewson SabrinaJewson deleted the routing-docs branch September 22, 2024 12:25
jplatte pushed a commit that referenced this pull request Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants