diff --git a/src/metrics.rs b/src/metrics.rs index a821d4d..afc6bd3 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -19,6 +19,7 @@ use crate::stats::Stats; use crate::stats::beobachten::BeobachtenStore; use crate::transport::{ListenOptions, create_listener}; +/// Serves the Prometheus metrics and beobachten plaintext endpoints. pub async fn serve( port: u16, listen: Option, @@ -205,6 +206,7 @@ async fn handle( let resp = Response::builder() .status(StatusCode::NOT_FOUND) + .header("content-type", "text/plain; charset=utf-8") .body(Full::new(Bytes::from("Not Found\n"))) .unwrap(); Ok(resp) @@ -2782,5 +2784,9 @@ mod tests { .await .unwrap(); assert_eq!(resp404.status(), StatusCode::NOT_FOUND); + assert_eq!( + resp404.headers().get("content-type").unwrap(), + "text/plain; charset=utf-8" + ); } }