Skip to content
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

Router re-export can cause confusion #33

Open
davidpdrsn opened this issue Mar 14, 2022 · 1 comment
Open

Router re-export can cause confusion #33

davidpdrsn opened this issue Mar 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@davidpdrsn
Copy link
Contributor

axum's Router is generic over the request body but it defaults the type parameter to axum::body::Body (hyper's body type). However that isn't compatible with this library which requires axum::body::BoxBody such that middleware can more easily change the request body type. Typing axum::Router<axum::body::BoxBody> is tedious so we've added this re-export:

pub type Router<B = BoxBody> = axum::Router<B>;

However that means there are now two routers to know about: the one in axum and one in this library. They're subtly different because Server::with doesn't support axum::Router but it does support server_framework::Router.

All this can be very confusing to new users who aren't familiar with the ecosystem and things fit together.

We should consider ways to fix, or least alleviate this.

@davidpdrsn davidpdrsn added the bug Something isn't working label Mar 14, 2022
@davidpdrsn
Copy link
Contributor Author

I have found a good solution to this that fixes the root cause in axum.

Relevant PRs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant