mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Add content-type header to metrics server response (#3970)
This fixes issues with certain metrics scrapers, which might error if the content-type is not correctly set. ## Issue Addressed Fixes https://github.com/sigp/lighthouse/issues/3437 ## Proposed Changes Simply set header: `Content-Type: text/plain` on metrics server response. Seems like the errored branch does this correctly already. ## Additional Info This is needed also to enable influx-db metric scraping which work very nicely with Geth.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use beacon_chain::test_utils::EphemeralHarnessType;
|
||||
use environment::null_logger;
|
||||
use http_metrics::Config;
|
||||
use reqwest::header::HeaderValue;
|
||||
use reqwest::StatusCode;
|
||||
use std::net::{IpAddr, Ipv4Addr};
|
||||
use std::sync::Arc;
|
||||
@@ -45,7 +46,13 @@ async fn returns_200_ok() {
|
||||
listening_socket.port()
|
||||
);
|
||||
|
||||
assert_eq!(reqwest::get(&url).await.unwrap().status(), StatusCode::OK);
|
||||
let response = reqwest::get(&url).await.unwrap();
|
||||
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
assert_eq!(
|
||||
response.headers().get("Content-Type").unwrap(),
|
||||
&HeaderValue::from_str("text/plain").unwrap()
|
||||
);
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user