Have access to request in fallback #3423
Unanswered
GuillaumeGomez
asked this question in
Q&A
Replies: 1 comment 4 replies
-
You can definitely use |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi,
I'm in the middle of a rewrite of a server and for now, all requests are handled in one function and I'd like to keep it this way for now. However, using
fallback
, I can't passRequest
or basically anything to my method and I can't get my head around it. I was someone suggesting to useaxum::middleware::from_fn
withlayer
to be able to accessRequest
but again, impossible to make it work:The code looks like this:
serve_req
(which is the central function) is defined like this:Everytime I'm stuck with errors similar to:
So some traits are not implemented for async closures but that's not really helpful.
Anyway, if anyone has an idea, I'd love to hear it!
axum version
0.8.4
Beta Was this translation helpful? Give feedback.
All reactions