Move Html from axum-extra to axum (#2633)

This commit is contained in:
creativcoder 2024-09-29 14:30:38 +05:30 committed by GitHub
parent 3df15fd2ea
commit 3eb8854839
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 11 deletions

View file

@ -66,14 +66,6 @@ macro_rules! mime_response {
}; };
} }
mime_response! {
/// A HTML response.
///
/// Will automatically get `Content-Type: text/html; charset=utf-8`.
Html,
TEXT_HTML_UTF_8,
}
mime_response! { mime_response! {
/// A JavaScript response. /// A JavaScript response.
/// ///

View file

@ -1,6 +1,5 @@
#![doc = include_str!("../docs/response.md")] #![doc = include_str!("../docs/response.md")]
use axum_core::body::Body;
use http::{header, HeaderValue}; use http::{header, HeaderValue};
mod redirect; mod redirect;
@ -40,7 +39,7 @@ pub struct Html<T>(pub T);
impl<T> IntoResponse for Html<T> impl<T> IntoResponse for Html<T>
where where
T: Into<Body>, T: IntoResponse,
{ {
fn into_response(self) -> Response { fn into_response(self) -> Response {
( (
@ -48,7 +47,7 @@ where
header::CONTENT_TYPE, header::CONTENT_TYPE,
HeaderValue::from_static(mime::TEXT_HTML_UTF_8.as_ref()), HeaderValue::from_static(mime::TEXT_HTML_UTF_8.as_ref()),
)], )],
self.0.into(), self.0,
) )
.into_response() .into_response()
} }