3 ms·
axum's Response is an alias for `http::Response<UnsyncBoxBody<Bytes, Error>>`. It's not a fallback or catch-all, it's the type that axum expects to be returned
by 0x457 4y ago
axum's Response is an alias for `http::Response<UnsyncBoxBody<Bytes, Error>>`. It's not a fallback or catch-all, it's the type that axum expects to be returned by handler directly or indirectly via `IntoResponse` trait. All of that is very clear if you open : https://docs.rs/axum/latest/axum/index.html https://docs.rs/axum/latest/axum/index.html
Look at `IntoResponse` trait, you will see that it's the type you need to return. The difference between `impl IntoResponse`, Some type that implements `IntoResponse` and `http::Response<UnsyncBoxBody<Bytes, Error>>` is where conversion happens: explicitly by your handler or by axum implicitly.
You don't have to "explicitly convert to Bytes", you call `into_response` on whatever implements it.