Skip to content

Commit 7d8c327

Browse files
authored
impl From<hyper::Body> for Body (#1236)
This implements a conversion from `hyper::Body` to `reqwest::Body`, which in turn enables converting a `http::Request<hyper::Body>` into `reqwest::Request` through the existing `TryFrom` implementation. Fixes #1156.
1 parent 1614c5e commit 7d8c327

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/async_impl/body.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ impl Body {
161161
}
162162
}
163163

164+
impl From<hyper::Body> for Body {
165+
#[inline]
166+
fn from(body: hyper::Body) -> Body {
167+
Self {
168+
inner: Inner::Streaming {
169+
body: Box::pin(WrapHyper(body)),
170+
timeout: None,
171+
},
172+
}
173+
}
174+
}
175+
164176
impl From<Bytes> for Body {
165177
#[inline]
166178
fn from(bytes: Bytes) -> Body {

0 commit comments

Comments
 (0)