fix improper handling of request body backpressure

Closes #348
This commit is contained in:
Sean McArthur
2018-09-19 14:20:08 -07:00
parent 276c3d6594
commit 2698148743
8 changed files with 166 additions and 68 deletions

View File

@@ -86,9 +86,9 @@ impl Request {
let mut req_async = self.inner;
let body = self.body.and_then(|body| {
let (tx, body, len) = body::async(body);
let (tx, body, len) = body.into_async();
if let Some(len) = len {
req_async.headers_mut().insert(CONTENT_LENGTH, HeaderValue::from_str(len.to_string().as_str()).expect(""));
req_async.headers_mut().insert(CONTENT_LENGTH, len.into());
}
*req_async.body_mut() = Some(body);
tx