[axum] Type conflict

Hi, I have a handler returning Result<Response<BoxBody>, Infallible> that can return http errors or call ServeDir::oneshot but it fails to compile:

expected enum `std::result::Result<hyper::Response<http_body::combinators::box_body::UnsyncBoxBody<axum::body::Bytes, axum::Error>>, std::convert::Infallible>`
found enum `std::result::Result<hyper::Response<tower_http::services::fs::ServeFileSystemResponseBody>, std::io::Error>`

I’m also seeing that ServeFileSystemResponseBody has the correct type in its Body implementation Data but I’m quite puzzled on how to make the types match.

Thanks for any help!

Found it: Serving Static Files With Axum

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.