Skip to content

Commit

Permalink
Add missing Content-Type header
Browse files Browse the repository at this point in the history
  • Loading branch information
barrelmaker97 committed Nov 26, 2024
1 parent 9d4120f commit e84eba8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit e84eba8

Please sign in to comment.