Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Html from axum-extra to axum #2633

Merged
merged 6 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions axum-extra/src/response/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
/// A JavaScript response.
///
Expand Down
5 changes: 2 additions & 3 deletions axum/src/response/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![doc = include_str!("../docs/response.md")]

use axum_core::body::Body;
use http::{header, HeaderValue};

mod redirect;
jplatte marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -40,15 +39,15 @@ pub struct Html<T>(pub T);

impl<T> IntoResponse for Html<T>
where
T: Into<Body>,
T: IntoResponse,
{
fn into_response(self) -> Response {
(
[(
header::CONTENT_TYPE,
HeaderValue::from_static(mime::TEXT_HTML_UTF_8.as_ref()),
)],
self.0.into(),
self.0,
)
.into_response()
}
Expand Down