Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tower_http::ServeDir no longer compatible with axum 0.7 #2416

Closed
1 task done
slatian opened this issue Dec 9, 2023 · 0 comments
Closed
1 task done

tower_http::ServeDir no longer compatible with axum 0.7 #2416

slatian opened this issue Dec 9, 2023 · 0 comments

Comments

@slatian
Copy link

slatian commented Dec 9, 2023

  • I have looked for existing issues (including closed) about this

Bug Report

In previous versions (0.6 series) of axum one could use the very useful tower_http::ServeDir with an axum Router (other types are affected as well), simply by adding it as a service.

let app = Router::new()
    .route("/", get(handle_default_route))
    .fallback_service(
        ServeDir::new(static_file_directory)
            .fallback(not_found_handler.with_state(shared_state.clone()))
    )

This no longer works because (I aassume) the responses are now Response<Body> instead of being able to be a Response<UnsyncBoxBody<Bytes, BoxError> which is still used by the tower_http.

breaking: The following types/traits are no longer generic over the request body
(i.e. the B type param has been removed) (#1751 and #1789):
[…]

I have not seen anyone solve this for axum 0.7 and was unable to solve this myself.

Maybe there is a simple solution in which case official documentation on how to make this work again would be nice.

@tokio-rs tokio-rs locked and limited conversation to collaborators Dec 9, 2023
@jplatte jplatte converted this issue into discussion #2418 Dec 9, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant