11// Copyright (c) 2025 Cloudflare, Inc. All rights reserved.
22// SPDX-License-Identifier: BSD-3-Clause
33
4- use std:: io:: Cursor ;
5-
64use axum:: {
75 async_trait,
86 body:: Bytes ,
@@ -41,11 +39,10 @@ macro_rules! impl_decode_from_dap_http_body {
4139 bytes: Bytes ,
4240 meta: & DapRequestMeta ,
4341 ) -> Result <Self , DapAbort > {
44- let mut cursor = Cursor :: new( bytes. as_ref( ) ) ;
4542 // Check that media type matches.
4643 meta. get_checked_media_type( DapMediaType :: $type) ?;
4744 // Decode the body
48- $type:: decode_with_param ( & meta. version, & mut cursor )
45+ $type:: get_decoded_with_param ( & meta. version, bytes . as_ref ( ) )
4946 . map_err( |e| DapAbort :: from_codec_error( e, meta. task_id) )
5047 }
5148 }
@@ -62,11 +59,10 @@ impl_decode_from_dap_http_body!(
6259
6360impl DecodeFromDapHttpBody for HashedAggregationJobReq {
6461 fn decode_from_http_body ( bytes : Bytes , meta : & DapRequestMeta ) -> Result < Self , DapAbort > {
65- let mut cursor = Cursor :: new ( bytes. as_ref ( ) ) ;
6662 // Check that media type matches.
6763 meta. get_checked_media_type ( DapMediaType :: AggregationJobInitReq ) ?;
6864 // Decode the body
69- HashedAggregationJobReq :: decode_with_param ( & meta. version , & mut cursor )
65+ HashedAggregationJobReq :: get_decoded_with_param ( & meta. version , bytes . as_ref ( ) )
7066 . map_err ( |e| DapAbort :: from_codec_error ( e, meta. task_id ) )
7167 }
7268}
0 commit comments