Fix issue where HTML responses had two different content-type headers

This commit is contained in:
Pantonshire committed 2022-05-17 20:03:07 +01:00
1 parent 7e5cfd058e
commit d566d02a4f
1 file changed
+10 -11
+10 -11
View File
@@ -1,8 +1,12 @@
use std::borrow::Cow; use std::{
use std::fmt::{self, Write}; borrow::Cow,
fmt::{self, Write},
};
use axum::response::{IntoResponse, Response}; use axum::{
use axum::http::{self, StatusCode}; http::StatusCode,
response::{IntoResponse, Html, Response},
};
use maud::{html, Markup, Render, Escaper, DOCTYPE}; use maud::{html, Markup, Render, Escaper, DOCTYPE};
#[derive(Debug)] #[derive(Debug)]
@@ -140,13 +144,8 @@ impl IntoResponse for HtmlResponse {
} }
}; };
let mut response = (self.status, html_doc.into_string()) (self.status, Html(html_doc.into_string()))
.into_response(); .into_response()
response.headers_mut()
.append("Content-Type", http::HeaderValue::from_static("text/html; charset=utf-8"));
response
} }
} }