From e011941964b1c1e0b90f85014d166d64a83ae8e2 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 7 Feb 2024 15:25:49 +0100 Subject: [dep-upgrade-202402] refactor use of BodyStream --- src/api/signature/streaming.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/api/signature/streaming.rs') diff --git a/src/api/signature/streaming.rs b/src/api/signature/streaming.rs index ea5a64e2..39147ca0 100644 --- a/src/api/signature/streaming.rs +++ b/src/api/signature/streaming.rs @@ -5,7 +5,7 @@ use futures::prelude::*; use futures::task; use garage_model::key_table::Key; use hmac::Mac; -use http_body_util::{BodyStream, StreamBody}; +use http_body_util::StreamBody; use hyper::body::{Bytes, Incoming as IncomingBody}; use hyper::Request; @@ -51,11 +51,9 @@ pub fn parse_streaming_body( .ok_or_internal_error("Unable to build signing HMAC")?; Ok(req.map(move |body| { - let body_stream = BodyStream::new(body) - .map(|x| x.map(|f| f.into_data().unwrap())) //TODO remove unwrap - .map_err(Error::from); + let stream = body_stream::<_, Error>(body); let signed_payload_stream = - SignedPayloadStream::new(body_stream, signing_hmac, date, &scope, signature) + SignedPayloadStream::new(stream, signing_hmac, date, &scope, signature) .map(|x| x.map(hyper::body::Frame::data)) .map_err(Error::from); ReqBody::new(StreamBody::new(signed_payload_stream)) -- cgit v1.2.3