Accessing Request in handler as well as FromRequest
#930
-
I have come across a weird behavior so I’m curious if it’s by design and if so why? ContextI’m writing a library to make it easy to write Cloud Foundry Route Services which are basically an app on cf acting as a guard and reverse proxy. Theres already a crate basically just proxying a Behavior seenTo call my proxying function pub async fn proxy_request( req: Request<Body> ) { I need to have the request so: pub async fn handle(req: Request<_>) { Until now, everything works ok. If I would like to have a header at my disposal async fn handle(req: Request<_>, TypedHeader(meta): TypedHeader<ProxyMetadata>) { The request failes with the message:
Now If I remove the
Reason why this sucksNow I get it Is this by design? PS: Didn't open an issue as from me its a general question |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
See https://docs.rs/axum/latest/axum/extract/index.html#applying-multiple-extractors. You need to put the |
Beta Was this translation helpful? Give feedback.
See https://docs.rs/axum/latest/axum/extract/index.html#applying-multiple-extractors. You need to put the
Request
extractor last.