1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-30 00:29:29 +02:00

Make payload and httprequest a stream

This commit is contained in:
Nikolay Kim
2018-02-25 11:21:45 +03:00
parent 4e41e13baf
commit 141b992450
5 changed files with 37 additions and 83 deletions

View File

@@ -111,7 +111,7 @@ impl<S, T: DeserializeOwned> JsonBody<S, T> {
}
}
impl<S, T: DeserializeOwned + 'static> Future for JsonBody<S, T> {
impl<S: 'static, T: DeserializeOwned + 'static> Future for JsonBody<S, T> {
type Item = T;
type Error = JsonPayloadError;
@@ -134,8 +134,7 @@ impl<S, T: DeserializeOwned + 'static> Future for JsonBody<S, T> {
}
let limit = self.limit;
let fut = req.payload().readany()
.from_err()
let fut = req.from_err()
.fold(BytesMut::new(), move |mut body, chunk| {
if (body.len() + chunk.len()) > limit {
Err(JsonPayloadError::Overflow)