-
Notifications
You must be signed in to change notification settings - Fork 1.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
Update middleware.md - existing documentation doesn't compile #3231
Conversation
I ran into an issue following the documentation trying to implement a uri-rewrite middleware. Found https://users.rust-lang.org/t/rewrite-request-uri-in-middleware-for-axum/104619 - which fixed this issue, so updating the doc to reflect this
When I copy the original code from docs it compiles for me. CI also fails on the changes you made because that documentation example does not seem to compile. The issue you linked also seems to have been caused by an incorrect signature of the middleware. Can you try providing a full example of what regarding this example does not compile for you? |
Hmm, this code errors for me with some very unhelpful error messages.
Cargo.toml dependencies
Sorry I am very new to rust, so it could be some horrible oversight on my part, but assume it was just outdated documentation due to the linked changes working. |
I just noticed that my signature differs from the one in the doc, as I am taking a mutable reference. It seems like axom::middleware::map_request is already documented on this change difference.
I guess the thing that I actually want is better error messages, but that is clearly out of scope. Thanks for your time looking into this, and sorry for the inconvenience. |
I ran into an issue following the documentation trying to implement a uri-rewrite middleware.
Found https://users.rust-lang.org/t/rewrite-request-uri-in-middleware-for-axum/104619 - which fixed this issue, so updating the doc to reflect this
Motivation
Solution