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:
@@ -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 {
|
impl From<Bytes> for Body {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(bytes: Bytes) -> Body {
|
fn from(bytes: Bytes) -> Body {
|
||||||
|
|||||||
Reference in New Issue
Block a user