Skip to content

Commit 9a0cd67

Browse files
committed
fix: simplify mime type
1 parent c5fbb4b commit 9a0cd67

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/webserver/error.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ fn error_to_html_string(app_state: &AppState, err: &anyhow::Error) -> anyhow::Re
5454

5555
fn anyhow_err_to_actix_resp(e: &anyhow::Error, state: &AppState) -> HttpResponse {
5656
let mut resp = HttpResponseBuilder::new(StatusCode::INTERNAL_SERVER_ERROR);
57-
resp.insert_header((
58-
header::CONTENT_TYPE,
59-
header::HeaderValue::from_static("text/plain; charset=utf-8"),
60-
));
57+
resp.insert_header((header::CONTENT_TYPE, header::ContentType::plaintext()));
6158

6259
if let Some(status_err @ &ErrorWithStatus { .. }) = e.downcast_ref() {
6360
status_err.error_response()
@@ -72,10 +69,7 @@ fn anyhow_err_to_actix_resp(e: &anyhow::Error, state: &AppState) -> HttpResponse
7269
} else {
7370
match error_to_html_string(state, e) {
7471
Ok(body) => {
75-
resp.insert_header((
76-
header::CONTENT_TYPE,
77-
header::HeaderValue::from_static("text/html; charset=utf-8"),
78-
));
72+
resp.insert_header((header::CONTENT_TYPE, header::ContentType::html()));
7973
resp.body(body)
8074
}
8175
Err(second_err) => {

0 commit comments

Comments
 (0)