Allow HTTP API to return SSZ blocks (#2209)

## Issue Addressed

Implements https://github.com/ethereum/eth2.0-APIs/pull/125

## Proposed Changes

Optionally return SSZ bytes from the `beacon/blocks` endpoint.
This commit is contained in:
Michael Sproul
2021-02-24 04:15:14 +00:00
parent 5bc93869c8
commit 2f077b11fe
3 changed files with 56 additions and 9 deletions

View File

@@ -955,16 +955,18 @@ impl ApiTester {
pub async fn test_beacon_blocks(self) -> Self {
for block_id in self.interesting_block_ids() {
let result = self
let expected = self.get_block(block_id);
let json_result = self
.client
.get_beacon_blocks(block_id)
.await
.unwrap()
.map(|res| res.data);
assert_eq!(json_result, expected, "{:?}", block_id);
let expected = self.get_block(block_id);
assert_eq!(result, expected, "{:?}", block_id);
let ssz_result = self.client.get_beacon_blocks_ssz(block_id).await.unwrap();
assert_eq!(ssz_result, expected, "{:?}", block_id);
}
self