mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-28 07:20:12 +01:00
Move Html from axum-extra to axum (#2633)
This commit is contained in:
parent
3df15fd2ea
commit
3eb8854839
2 changed files with 2 additions and 11 deletions
|
@ -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.
|
||||||
///
|
///
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue