1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 17:07:01 +02:00

remove responsebody indirection from response (#2201)

This commit is contained in:
Rob Ede
2021-05-09 20:12:48 +01:00
committed by GitHub
parent a9dc1586a0
commit 900c9e270e
31 changed files with 381 additions and 263 deletions

View File

@@ -1,12 +1,13 @@
//! For middleware documentation, see [`Compat`].
use std::{
error::Error as StdError,
future::Future,
pin::Pin,
task::{Context, Poll},
};
use actix_http::body::{Body, MessageBody, ResponseBody};
use actix_http::body::{Body, MessageBody};
use actix_service::{Service, Transform};
use futures_core::{future::LocalBoxFuture, ready};
@@ -116,10 +117,10 @@ pub trait MapServiceResponseBody {
impl<B> MapServiceResponseBody for ServiceResponse<B>
where
B: MessageBody + Unpin + 'static,
B::Error: Into<Error>,
B::Error: Into<Box<dyn StdError + 'static>>,
{
fn map_body(self) -> ServiceResponse {
self.map_body(|_, body| ResponseBody::Other(Body::from_message(body)))
self.map_body(|_, body| Body::from_message(body))
}
}