From 2f1ef29f4fada7db8fba9a38212f6230144fe9a0 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Thu, 9 Dec 2021 17:08:07 +0300 Subject: [PATCH] add ServiceResponse::into_parts --- CHANGES.md | 2 ++ src/service.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 365c89af9..a52b1cca4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ * `ServiceResponse::map_into_{left,right}_body` and `HttpResponse::map_into_boxed_body`. [#2468] * Connection data set through the `HttpServer::on_connect` callback is now accessible only from the new `HttpRequest::conn_data()` and `ServiceRequest::conn_data()` methods. [#2491] * `HttpRequest::{req_data,req_data_mut}`. [#2487] +* `ServiceResponse::into_parts`. [#????] ### Changed * Rename `Accept::{mime_precedence => ranked}`. [#2480] @@ -37,6 +38,7 @@ [#2491]: https://github.com/actix/actix-web/pull/2491 [#2492]: https://github.com/actix/actix-web/pull/2492 [#2493]: https://github.com/actix/actix-web/pull/2493 +[#????]: https://github.com/actix/actix-web/pull/???? ## 4.0.0-beta.13 - 2021-11-30 diff --git a/src/service.rs b/src/service.rs index 88f2ba97a..b730fe23a 100644 --- a/src/service.rs +++ b/src/service.rs @@ -410,6 +410,12 @@ impl ServiceResponse { self.response.headers_mut() } + /// Destructure into request and response components + #[inline] + pub fn into_parts(self) -> (HttpRequest, HttpResponse) { + (self.request, self.response) + } + /// Extract response body #[inline] pub fn into_body(self) -> B {