Skip to content

Commit

Permalink
Remove Sync requirement from reqwest::Body::wrap_stream() (seanmonsta…
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunn1313 authored and Nutomic committed Nov 7, 2024
1 parent 548eed9 commit 29bd44b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ serde_urlencoded = "0.7.1"
tower-service = "0.3"
futures-core = { version = "0.3.28", default-features = false }
futures-util = { version = "0.3.28", default-features = false }
sync_wrapper = "1.0"
sync_wrapper = { version = "1.0", features = ["futures"] }

# Optional deps...

Expand Down
8 changes: 4 additions & 4 deletions src/async_impl/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Body {
#[cfg_attr(docsrs, doc(cfg(feature = "stream")))]
pub fn wrap_stream<S>(stream: S) -> Body
where
S: futures_core::stream::TryStream + Send + Sync + 'static,
S: futures_core::stream::TryStream + Send + 'static,
S::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
Bytes: From<S::Ok>,
{
Expand All @@ -98,19 +98,19 @@ impl Body {
#[cfg(any(feature = "stream", feature = "multipart", feature = "blocking"))]
pub(crate) fn stream<S>(stream: S) -> Body
where
S: futures_core::stream::TryStream + Send + Sync + 'static,
S: futures_core::stream::TryStream + Send + 'static,
S::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
Bytes: From<S::Ok>,
{
use futures_util::TryStreamExt;
use http_body::Frame;
use http_body_util::StreamBody;

let body = http_body_util::BodyExt::boxed(StreamBody::new(
let body = http_body_util::BodyExt::boxed(StreamBody::new(sync_wrapper::SyncStream::new(
stream
.map_ok(|d| Frame::data(Bytes::from(d)))
.map_err(Into::into),
));
)));
Body {
inner: Inner::Streaming(body),
}
Expand Down

0 comments on commit 29bd44b

Please sign in to comment.