axum-syntax-responses
axum-syntax-responses
Overview
A handler's return value becomes an http::Response through one trait:
IntoResponse. Its single method is fn into_response(self) -> Response<Body>,
where Body is axum::body::Body. Axum calls this method automatically on
whatever a handler returns, so the return type MUST implement IntoResponse or
the handler fails the Handler trait bound.
A companion trait, IntoResponseParts, modifies response parts (headers and
extensions) WITHOUT setting the status code or body. Tuples combine one
IntoResponse body with one or more IntoResponseParts elements and an
optional leading StatusCode, which is how a single return statement sets
status, headers, and body together.
Axum 0.8 removed the generic body type parameter. Every response body MUST be
axum::body::Body; hyper::Body is no longer re-exported.