Skip to content

Getting captured Path from extensions does not work #2032

Answered by davidpdrsn
kckeiks asked this question in Q&A
Discussion options

You must be logged in to vote

Getting capture path from extension does not work but getting MatchedPath does work. Is this expected?

Yep that is expected. Path needs to do more work than MatchedPath and we only wanna do that when you actually extract the path, rather than always do it up front.

So you need to run the future from Path::from_request_parts as part of generating the response. I'd recommend using axum::middleware::from_fn which makes it easy to run extractors.

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kckeiks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2029 on June 05, 2023 09:55.