Extended API

- Added a /beacon/validators function, to list all validators active in a particular epoch
 - Moved 'get_genesis_state' function, to align with router.
 - Added content-type for error responses
 - Tried adding a cache update call to fix issue getting validator duties (this is WIP)
This commit is contained in:
Luke Anderson
2019-09-04 23:03:05 +10:00
parent eeba69cd0f
commit bf2f459773
3 changed files with 65 additions and 10 deletions

View File

@@ -54,6 +54,7 @@ impl Into<Response<Body>> for ApiError {
};
Response::builder()
.status(status_code.0)
.header("content-type", "text/plain")
.body(Body::from(status_code.1))
.expect("Response should always be created.")
}
@@ -160,9 +161,7 @@ pub fn start_server<T: BeaconChainTypes>(
helpers::implementation_pending_response(req)
}
(&Method::GET, "/beacon/validators") => {
helpers::implementation_pending_response(req)
}
(&Method::GET, "/beacon/validators") => beacon::get_validators::<T>(req),
(&Method::GET, "/beacon/validators/indicies") => {
helpers::implementation_pending_response(req)
}