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
+3 -3
View File
@@ -12,7 +12,7 @@ macro_rules! define_rejection {
#[allow(deprecated)]
impl $crate::response::IntoResponse for $name {
fn into_response(self) -> http::Response<$crate::body::BoxBody> {
fn into_response(self) -> $crate::response::Response {
let mut res = http::Response::new($crate::body::boxed(http_body::Full::from($body)));
*res.status_mut() = http::StatusCode::$status;
res
@@ -54,7 +54,7 @@ macro_rules! define_rejection {
}
impl crate::response::IntoResponse for $name {
fn into_response(self) -> http::Response<$crate::body::BoxBody> {
fn into_response(self) -> $crate::response::Response {
let body = http_body::Full::from(format!(concat!($body, ": {}"), self.0));
let body = $crate::body::boxed(body);
let mut res =
@@ -97,7 +97,7 @@ macro_rules! composite_rejection {
}
impl $crate::response::IntoResponse for $name {
fn into_response(self) -> http::Response<$crate::body::BoxBody> {
fn into_response(self) -> $crate::response::Response {
match self {
$(
Self::$variant(inner) => inner.into_response(),