diff --git a/actix-http/src/body/body.rs b/actix-http/src/body/body.rs
index ff4ff3292..c86bf9234 100644
--- a/actix-http/src/body/body.rs
+++ b/actix-http/src/body/body.rs
@@ -7,7 +7,7 @@ use std::{
};
use bytes::{Bytes, BytesMut};
-use futures_core::Stream;
+use futures_core::{ready, Stream};
use crate::error::Error;
@@ -72,7 +72,11 @@ impl MessageBody for Body {
Poll::Ready(Some(Ok(mem::take(bin))))
}
}
- Body::Message(body) => body.as_mut().poll_next(cx).map_err(Into::into),
+ Body::Message(body) => match ready!(body.as_mut().poll_next(cx)) {
+ Some(Err(err)) => Poll::Ready(Some(Err(err.into()))),
+ Some(Ok(val)) => Poll::Ready(Some(Ok(val))),
+ None => Poll::Ready(None),
+ },
}
}
}
@@ -212,6 +216,10 @@ impl MessageBody for BoxAnyBody {
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll