From e84eba80f55846996a96188d678b9cce19d15c03 Mon Sep 17 00:00:00 2001 From: Nolan Cooper Date: Tue, 26 Nov 2024 09:16:53 -0600 Subject: [PATCH] Add missing Content-Type header --- src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f235a2a..c259d38 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -717,7 +717,16 @@ impl Server { #[cfg(feature = "internal_metrics")] internal_metrics.http_body_gauge.set(buffer.len() as i64); - let response = Response::from_data(buffer).with_status_code(status_code); + let response = Response::from_data(buffer) + .with_status_code(status_code) + .with_header(Header { + field: "Content-Type" + .parse() + .expect("can not parse content-type header field. this should never fail"), + value: "text/plain; charset=UTF-8" + .parse() + .expect("can not parse header value. this should never fail"), + }); request.respond(response).map_err(HandlerError::Response)?; Ok(())