mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
Further aligning the API & implementation.
- Completed implementation of /beacon/head - renamed 'latest_finalized_checkpoint' to 'current_finalized_checkpoint' for consistency - Reorganised list of endpoints in both spec & router so that they match - Fixed the content-type modifications for /metrics - Added a new 'RFC' tag to the spec, to tag things that we have not implemented and aren't sure if it's useful. - Moved 'deposit_contract' under /spec
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::{success_response, ApiError, ApiResult, DBPath};
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use http::HeaderValue;
|
||||
use hyper::{Body, Request};
|
||||
use prometheus::{Encoder, TextEncoder};
|
||||
use std::sync::Arc;
|
||||
@@ -67,10 +68,10 @@ pub fn get_prometheus<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiR
|
||||
.map(|string| {
|
||||
let mut response = success_response(Body::from(string));
|
||||
// Need to change the header to text/plain for prometheius
|
||||
response
|
||||
.headers_mut()
|
||||
.insert("content-type", "text/plain; charset=utf-8".parse().unwrap())
|
||||
.unwrap();
|
||||
response.headers_mut().insert(
|
||||
"content-type",
|
||||
HeaderValue::from_static("text/plain; charset=utf-8"),
|
||||
);
|
||||
response
|
||||
})
|
||||
.map_err(|e| ApiError::ServerError(format!("Failed to encode prometheus info: {:?}", e)))
|
||||
|
||||
Reference in New Issue
Block a user