mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Move Headers into axum
This commit is contained in:
@@ -19,11 +19,6 @@ use http_body::{
|
||||
};
|
||||
use std::{borrow::Cow, convert::Infallible, iter};
|
||||
|
||||
mod headers;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use self::headers::Headers;
|
||||
|
||||
/// Type alias for [`http::Response`] whose body type defaults to [`BoxBody`], the most common body
|
||||
/// type used with axum.
|
||||
pub type Response<T = BoxBody> = http::Response<T>;
|
||||
@@ -356,17 +351,10 @@ impl IntoResponse for StatusCode {
|
||||
}
|
||||
}
|
||||
|
||||
impl<H> IntoResponse for H
|
||||
where
|
||||
H: IntoResponseHeaders,
|
||||
{
|
||||
impl IntoResponse for HeaderMap {
|
||||
fn into_response(self) -> Response {
|
||||
let mut res = Response::new(boxed(Empty::new()));
|
||||
|
||||
if let Err(e) = try_extend_headers(res.headers_mut(), self.into_headers()) {
|
||||
return e;
|
||||
}
|
||||
|
||||
*res.headers_mut() = self;
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user