Propagate async timeout to response body (#503)

This commit is contained in:
Sean McArthur
2019-04-22 15:24:35 -07:00
committed by GitHub
parent ce51fe83d6
commit f6ce085457
4 changed files with 97 additions and 39 deletions

View File

@@ -346,7 +346,7 @@ impl ClientBuilder {
/// Enables a request timeout.
///
/// The timeout is applied from the when the request starts connecting
/// until the response headers are received. Bodies are not affected.
/// until the response body has finished.
///
/// Default is no timeout.
pub fn timeout(mut self, timeout: Duration) -> ClientBuilder {
@@ -839,7 +839,7 @@ impl Future for PendingRequest {
}
}
}
let res = Response::new(res, self.url.clone(), self.client.gzip);
let res = Response::new(res, self.url.clone(), self.client.gzip, self.timeout.take());
return Ok(Async::Ready(res));
}
}