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:
Kai Jewson
2021-12-05 19:16:46 +01:00
committed by GitHub
parent cbb34869d8
commit dfb06e721c
41 changed files with 210 additions and 237 deletions
+4 -4
View File
@@ -4,9 +4,9 @@
mod de;
use crate::{
body::{boxed, BoxBody, Full},
body::{boxed, Full},
extract::{rejection::*, FromRequest, RequestParts},
response::IntoResponse,
response::{IntoResponse, Response},
routing::{InvalidUtf8InPathParam, UrlParams},
};
use async_trait::async_trait;
@@ -370,7 +370,7 @@ impl FailedToDeserializePathParams {
}
impl IntoResponse for FailedToDeserializePathParams {
fn into_response(self) -> http::Response<BoxBody> {
fn into_response(self) -> Response {
let (status, body) = match self.0.kind {
ErrorKind::Message(_)
| ErrorKind::InvalidUtf8InPathParam { .. }
@@ -385,7 +385,7 @@ impl IntoResponse for FailedToDeserializePathParams {
(StatusCode::INTERNAL_SERVER_ERROR, self.0.kind.to_string())
}
};
let mut res = http::Response::new(boxed(Full::from(body)));
let mut res = Response::new(boxed(Full::from(body)));
*res.status_mut() = status;
res
}