From a79fc98e36eac485803b1ab97f35c60198fd72cb Mon Sep 17 00:00:00 2001 From: Bradley Beddoes Date: Thu, 6 Jul 2017 10:38:57 +1000 Subject: [PATCH] feat(server): Provide reference to Response body The Response body was previously inaccessible to application code. This change allows applications that may wish to alter the Response based on previous creation (or not) of the body to do so. n.b. discussion in #1216 indicates this function may change in 0.12 or be removed in favour of some other api. Closes #1216. --- src/http/response.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/http/response.rs b/src/http/response.rs index 3611c0fd7e..9a81404504 100644 --- a/src/http/response.rs +++ b/src/http/response.rs @@ -93,6 +93,10 @@ impl Response { self.set_body(body); self } + + /// Read the body. + #[inline] + pub fn body_ref(&self) -> Option<&B> { self.body.as_ref() } } impl Response {