File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,11 @@ impl BeaconNodeHttpClient {
218
218
219
219
/// Perform a HTTP GET request, returning `None` on a 404 error.
220
220
async fn get_opt < T : DeserializeOwned , U : IntoUrl > ( & self , url : U ) -> Result < Option < T > , Error > {
221
- match self . get_response ( url, |b| b) . await . optional ( ) ? {
221
+ match self
222
+ . get_response ( url, |b| b. accept ( Accept :: Json ) )
223
+ . await
224
+ . optional ( ) ?
225
+ {
222
226
Some ( response) => Ok ( Some ( response. json ( ) . await ?) ) ,
223
227
None => Ok ( None ) ,
224
228
}
@@ -982,16 +986,14 @@ impl BeaconNodeHttpClient {
982
986
983
987
/// `GET beacon/deposit_snapshot`
984
988
pub async fn get_deposit_snapshot ( & self ) -> Result < Option < types:: DepositTreeSnapshot > , Error > {
985
- use ssz:: Decode ;
986
989
let mut path = self . eth_path ( V1 ) ?;
987
990
path. path_segments_mut ( )
988
991
. map_err ( |( ) | Error :: InvalidUrl ( self . server . clone ( ) ) ) ?
989
992
. push ( "beacon" )
990
993
. push ( "deposit_snapshot" ) ;
991
- self . get_bytes_opt_accept_header ( path, Accept :: Ssz , self . timeouts . get_deposit_snapshot )
992
- . await ?
993
- . map ( |bytes| DepositTreeSnapshot :: from_ssz_bytes ( & bytes) . map_err ( Error :: InvalidSsz ) )
994
- . transpose ( )
994
+ self . get_opt :: < GenericResponse < _ > , _ > ( path)
995
+ . await
996
+ . map ( |opt| opt. map ( |r| r. data ) )
995
997
}
996
998
997
999
/// `POST beacon/rewards/sync_committee`
You can’t perform that action at this time.
0 commit comments