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.
This commit is contained in:
Jon Gjengset
2021-04-08 16:21:29 -04:00
committed by GitHub
parent 1614c5ea64
commit 7d8c32784e

View File

@@ -161,6 +161,18 @@ impl Body {
}
}
impl From<hyper::Body> for Body {
#[inline]
fn from(body: hyper::Body) -> Body {
Self {
inner: Inner::Streaming {
body: Box::pin(WrapHyper(body)),
timeout: None,
},
}
}
}
impl From<Bytes> for Body {
#[inline]
fn from(bytes: Bytes) -> Body {