mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-25 00:00:23 +02:00
Introduce Response type alias as a shorthand for Response<BoxBody> (#590)
* Introduce `Response` type alias as a shorthand * Don't re-export `Response` at the crate root
This commit is contained in:
@@ -5,9 +5,10 @@
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
body::{Body, BoxBody, Bytes},
|
||||
body::{Body, Bytes},
|
||||
error_handling::HandleErrorLayer,
|
||||
http::{Request, Response, StatusCode},
|
||||
http::{Request, StatusCode},
|
||||
response::Response,
|
||||
routing::post,
|
||||
Router,
|
||||
};
|
||||
@@ -54,7 +55,7 @@ async fn map_request(req: Request<Body>) -> Result<Request<Body>, BoxError> {
|
||||
Ok(req)
|
||||
}
|
||||
|
||||
async fn map_response(res: Response<BoxBody>) -> Result<Response<Body>, BoxError> {
|
||||
async fn map_response(res: Response) -> Result<Response<Body>, BoxError> {
|
||||
let (parts, body) = res.into_parts();
|
||||
let bytes = buffer_and_print("response", body).await?;
|
||||
let res = Response::from_parts(parts, Body::from(bytes));
|
||||
|
||||
Reference in New Issue
Block a user