Skip to content

Commit

Permalink
Merge pull request #1122 from nox/response-get-ref
Browse files Browse the repository at this point in the history
Introduce Response::get_ref
  • Loading branch information
seanmonstar authored Apr 10, 2017
2 parents 02b52f6 + 5ef0ec2 commit 04d9119
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/client/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct Response {
}

impl Response {

/// Creates a new response from a server.
pub fn new(url: Url, stream: Box<NetworkStream + Send>) -> ::Result<Response> {
trace!("Response::new");
Expand Down Expand Up @@ -62,6 +61,12 @@ impl Response {
pub fn status_raw(&self) -> &RawStatus {
&self.status_raw
}

/// Gets a borrowed reference to the underlying `HttpMessage`.
#[inline]
pub fn get_ref(&self) -> &HttpMessage {
&*self.message
}
}

/// Read the response body.
Expand Down
2 changes: 1 addition & 1 deletion src/http/h1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ impl Http11Message {
}
}

/// Gets a mutable reference to the underlying `NetworkStream`, regardless of the state of the
/// Gets a borrowed reference to the underlying `NetworkStream`, regardless of the state of the
/// `Http11Message`.
pub fn get_ref(&self) -> &(NetworkStream + Send) {
match *self.stream.as_ref() {
Expand Down

0 comments on commit 04d9119

Please sign in to comment.