mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
Changes to rest_api (#480)
* Add half-finished rest api changes * Add basic, messy changes to rest api * Fix expect() in ApiRequest * Remove ApiRequest, add route for beacon state * Tidy rest api, add get state from root * Add api method for getting state roots by slot * Add test for URL helper * Simplify state_at_slot fn * Add tests for rest api helper fns * Add extra tests for parse root * Fix clippy lints * Fix compile error in rest api * Update test to new ethereum-types
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
macro_rules! result_to_response {
|
||||
($handler: path) => {
|
||||
|req: Request<Body>| -> Response<Body> {
|
||||
let log = req
|
||||
.extensions()
|
||||
.get::<slog::Logger>()
|
||||
.expect("Our logger should be on req.")
|
||||
.clone();
|
||||
let path = path_from_request(&req);
|
||||
let result = $handler(req);
|
||||
match result {
|
||||
Ok(response) => {
|
||||
info!(log, "Request successful: {:?}", path);
|
||||
response
|
||||
}
|
||||
Err(e) => {
|
||||
info!(log, "Request failure: {:?}", path);
|
||||
e.into()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user