Skip to content

Commit

Permalink
simplify body creation
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
  • Loading branch information
yoshuawuyts committed Aug 3, 2019
1 parent c4b00b5 commit 94d2bc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/http_client/chttp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl HttpClient for ChttpClient {
let res = client.send_async(req).await?;

let (parts, body) = res.into_parts();
let body = Body::from_reader(Box::new(body));
let body = Body::from_reader(body);
let res = http::Response::from_parts(parts, body);
Ok(res)
})
Expand Down
6 changes: 4 additions & 2 deletions src/http_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ impl Body {
}

/// Create a new instance from a reader.
pub fn from_reader(reader: Box<dyn AsyncRead + Unpin + Send + 'static>) -> Self {
Self { reader }
pub fn from_reader(reader: impl AsyncRead + Unpin + Send + 'static) -> Self {
Self {
reader: Box::new(reader),
}
}
}

Expand Down

0 comments on commit 94d2bc6

Please sign in to comment.