feat(body): Update Payload to be a trait alias of http_body::Body (#1908)

This commit is contained in:
Lucio Franco
2019-08-22 14:13:27 -07:00
committed by Sean McArthur
parent 49b12c415d
commit 79c32f8953
9 changed files with 84 additions and 100 deletions

View File

@@ -289,19 +289,10 @@ where
}
// automatically set Content-Length from body...
if let Some(len) = body.content_length() {
if let Some(len) = body.size_hint().exact() {
headers::set_content_length_if_missing(res.headers_mut(), len);
}
if let Some(full) = body.__hyper_full_data(FullDataArg(())).0 {
let mut body_tx = reply!(false);
let buf = SendBuf(Some(full));
body_tx
.send_data(buf, true)
.map_err(crate::Error::new_body_write)?;
return Poll::Ready(Ok(()));
}
if !body.is_end_stream() {
let body_tx = reply!(false);
H2StreamState::Body(PipeToSendStream::new(body, body_tx))