Skip to content

Commit 056fd1b

Browse files
IngmarSteingi0baro
andauthored
fix: Set Content-Type header for metrics endpoint (#808)
* fix: Set Content-Type header for metrics endpoint * refactor --------- Co-authored-by: Giovanni Barillari <giovanni.barillari@sentry.io>
1 parent 5fe8547 commit 056fd1b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/metrics.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,10 @@ fn spawn_exporter(
382382
_ = connb.serve_connection(io, hyper::service::service_fn(move |_req| {
383383
let data = exp.get().data();
384384
async move {
385+
let mut response = hyper::Response::new(http_body_util::Full::new(hyper::body::Bytes::from(data)));
386+
response.headers_mut().append(hyper::header::CONTENT_TYPE, hyper::header::HeaderValue::from_static("text/plain"));
385387
Ok::<hyper::Response<http_body_util::Full<hyper::body::Bytes>>, std::convert::Infallible>(
386-
hyper::Response::new(http_body_util::Full::new(hyper::body::Bytes::from(data)))
388+
response
387389
)
388390
}
389391
})).await;

0 commit comments

Comments
 (0)