Skip to content

Commit

Permalink
fix(validator_client): return http 404 rather than 405 in http api (#…
Browse files Browse the repository at this point in the history
…4758)

## Issue Addressed
- Close #4596 

## Proposed Changes
- Add `Filter::recover` to handle rejections specifically as 404 NOT FOUND

Please list or describe the changes introduced by this PR.

## Additional Info

Similar to PR #3836
  • Loading branch information
duguorong009 committed Oct 4, 2023
1 parent ba8bcf4 commit 7d53721
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions validator_client/src/http_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,8 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.or(get_fee_recipient)
.or(get_gas_limit)
.or(get_std_keystores)
.or(get_std_remotekeys),
.or(get_std_remotekeys)
.recover(warp_utils::reject::handle_rejection),
)
.or(warp::post().and(
post_validators
Expand All @@ -1187,15 +1188,18 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.or(post_fee_recipient)
.or(post_gas_limit)
.or(post_std_keystores)
.or(post_std_remotekeys),
.or(post_std_remotekeys)
.recover(warp_utils::reject::handle_rejection),
))
.or(warp::patch().and(patch_validators))
.or(warp::patch()
.and(patch_validators.recover(warp_utils::reject::handle_rejection)))
.or(warp::delete().and(
delete_lighthouse_keystores
.or(delete_fee_recipient)
.or(delete_gas_limit)
.or(delete_std_keystores)
.or(delete_std_remotekeys),
.or(delete_std_remotekeys)
.recover(warp_utils::reject::handle_rejection),
)),
)
// The auth route and logs are the only routes that are allowed to be accessed without the API token.
Expand Down

0 comments on commit 7d53721

Please sign in to comment.