Skip to content

Commit

Permalink
feat(server): Provide reference to Response body
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bradleybeddoes committed Jul 6, 2017
1 parent c4c89a2 commit a79fc98
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/http/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ impl<B> Response<B> {
self.set_body(body);
self
}

/// Read the body.
#[inline]
pub fn body_ref(&self) -> Option<&B> { self.body.as_ref() }
}

impl Response<Body> {
Expand Down

0 comments on commit a79fc98

Please sign in to comment.