Ssz state api endpoint (#2111)

## Issue Addressed

Catching up to a recently merged API spec PR: https://github.com/ethereum/eth2.0-APIs/pull/119

## Proposed Changes

- Return an SSZ beacon state on `/eth/v1/debug/beacon/states/{stateId}` when passed this header: `accept: application/octet-stream`.
- requests to this endpoint with no  `accept` header or an `accept` header and a value of `application/json` or `*/*` , or will result in a JSON response

## Additional Info


Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
realbigsean
2021-01-06 03:01:46 +00:00
parent 939fa717fd
commit 588b90157d
4 changed files with 120 additions and 10 deletions

View File

@@ -1374,7 +1374,12 @@ impl ApiTester {
pub async fn test_get_debug_beacon_states(self) -> Self {
for state_id in self.interesting_state_ids() {
let result = self
let result_ssz = self
.client
.get_debug_beacon_states_ssz(state_id)
.await
.unwrap();
let result_json = self
.client
.get_debug_beacon_states(state_id)
.await
@@ -1384,7 +1389,8 @@ impl ApiTester {
let mut expected = self.get_state(state_id);
expected.as_mut().map(|state| state.drop_all_caches());
assert_eq!(result, expected, "{:?}", state_id);
assert_eq!(result_ssz, expected, "{:?}", state_id);
assert_eq!(result_json, expected, "{:?}", state_id);
}
self