From 10459915d799d7530d164bea77fb4791f832fe99 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 24 Nov 2021 14:15:46 +0000 Subject: [PATCH] add `Response::into_boxed_body` --- actix-http/CHANGES.md | 1 + src/response/response.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 52626d7fc..767029591 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -5,6 +5,7 @@ * Add timeout for canceling HTTP/2 server side connection handshake. Default to 5 seconds. [#2483] * HTTP/2 handshake timeout can be configured with `ServiceConfig::client_timeout`. [#2483] * Rename `body::BoxBody::{from_body => new}`. [#????] +* `Response::into_boxed_body`. [#????] * `body::EitherBody` enum. [#????] ### Changed diff --git a/src/response/response.rs b/src/response/response.rs index 23562ab0e..64673340b 100644 --- a/src/response/response.rs +++ b/src/response/response.rs @@ -228,7 +228,14 @@ impl HttpResponse { } // TODO: into_body equivalent - // TODO: into_boxed_body + + pub(crate) fn into_boxed_body(self) -> HttpResponse + where + B: MessageBody + 'static, + B::Error: Into>, + { + self.map_body(|_, body| BoxBody::new(body)) + } /// Extract response body pub fn into_body(self) -> B {