Skip to content

Issue migrating ServeDir handler from Axum 0.6 to 0.7 #2640

Answered by jplatte
JasonGH17 asked this question in Q&A
Discussion options

You must be logged in to vote

This is a really tricky one! I played around with it locally to find a solution. You can add a map_request before map_response to explicitly specify the request body type that the compiler fails to infer:

.map_request(|req: http::Request<axum::body::Body>| req)

There are other solutions, but I found them to be way too complicated. I would love if we could do something about this being so weird, but I'm not really certain how this could be fixed in tower / axum.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@JasonGH17
Comment options

@JasonGH17
Comment options

@jplatte
Comment options

Answer selected by JasonGH17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2639 on March 10, 2024 21:53.