From dd665a4c7e97a8a7513f38ad9293cd8edbe136df Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Sat, 5 Feb 2022 23:30:47 +0300 Subject: update to actix-web v4.0-rc.2 --- src/errors.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/errors.rs') diff --git a/src/errors.rs b/src/errors.rs index 70bad5c..5f55514 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -109,18 +109,19 @@ impl ResponseError for ContextualError { } /// Middleware to convert plain-text error responses to user-friendly web pages -pub fn error_page_middleware( +pub fn error_page_middleware( req: ServiceRequest, srv: &S, ) -> impl Future> + 'static where - S: Service, + S: Service, Error = actix_web::Error>, + B: MessageBody + 'static, S::Future: 'static, { let fut = srv.call(req); async { - let res = fut.await?; + let res = fut.await?.map_into_boxed_body(); if (res.status().is_client_error() || res.status().is_server_error()) && res.headers().get(header::CONTENT_TYPE).map(AsRef::as_ref) @@ -134,7 +135,7 @@ where } } -fn map_error_page<'a>(req: &HttpRequest, head: &mut ResponseHead, body: BoxBody) -> BoxBody { +fn map_error_page(req: &HttpRequest, head: &mut ResponseHead, body: BoxBody) -> BoxBody { let error_msg = match body.try_into_bytes() { Ok(bytes) => bytes, Err(body) => return body, -- cgit v1.2.3