Skip to content

Commit

Permalink
feat(client): add an accessor for the request body
Browse files Browse the repository at this point in the history
Allow users to access the body of the request.
Useful when one wants to modify the request based
on the data in the body, e.g. to add checksum headers.
  • Loading branch information
Twey committed Apr 20, 2017
1 parent bb7c9b9 commit 4e26646
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/client/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<B> Request<B> {
/// Read the Request Uri.
#[inline]
pub fn uri(&self) -> &Uri { &self.uri }

/// Read the Request Version.
#[inline]
pub fn version(&self) -> HttpVersion { self.version }
Expand All @@ -46,6 +46,10 @@ impl<B> Request<B> {
#[inline]
pub fn method(&self) -> &Method { &self.method }

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

/// Set the Method of this request.
#[inline]
pub fn set_method(&mut self, method: Method) { self.method = method; }
Expand Down

0 comments on commit 4e26646

Please sign in to comment.