mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 13:54:44 +00:00
Made async functions work!
- Cleaned up imports - Moved ApiError and such to it's own error.rs - Obsoleted 'success_response' in favour of new async regular and json only flavours - Made ApiError work async and be derived from hyper errors - Added a check to ensure an error is thrown if a non-json encoding is requested on a json-only function - Made all the individual service functions return futures (only node and network for now)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::{helpers::*, success_response, ApiError, ApiResult, DBPath};
|
||||
use crate::helpers::*;
|
||||
use crate::{ApiError, ApiResult, DBPath};
|
||||
use beacon_chain::BeaconChainTypes;
|
||||
use http::HeaderValue;
|
||||
use hyper::{Body, Request};
|
||||
@@ -62,7 +63,7 @@ pub fn get_prometheus<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiR
|
||||
|
||||
String::from_utf8(buffer)
|
||||
.map(|string| {
|
||||
let mut response = success_response(Body::from(string));
|
||||
let mut response = success_response_old(Body::from(string));
|
||||
// Need to change the header to text/plain for prometheus
|
||||
response.headers_mut().insert(
|
||||
"content-type",
|
||||
|
||||
Reference in New Issue
Block a user