Skip to content

Commit

Permalink
expose http::Extensions in Response (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
ducaale committed Mar 14, 2022
1 parent ee57777 commit 6dbac11
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/async_impl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ impl Response {
.map(|info| info.remote_addr())
}

/// Returns a reference to the associated extensions.
pub fn extensions(&self) -> &http::Extensions {
&self.extensions
}

/// Returns a mutable reference to the associated extensions.
pub fn extensions_mut(&mut self) -> &mut http::Extensions {
&mut self.extensions
}

// body methods

/// Get the full response text.
Expand Down
10 changes: 10 additions & 0 deletions src/blocking/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ impl Response {
self.inner.remote_addr()
}

/// Returns a reference to the associated extensions.
pub fn extensions(&self) -> &http::Extensions {
self.inner.extensions()
}

/// Returns a mutable reference to the associated extensions.
pub fn extensions_mut(&mut self) -> &mut http::Extensions {
self.inner.extensions_mut()
}

/// Get the content-length of the response, if it is known.
///
/// Reasons it may not be known:
Expand Down

0 comments on commit 6dbac11

Please sign in to comment.