Skip to content

Commit 4e26646

Browse files
committed
feat(client): add an accessor for the request body
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.
1 parent bb7c9b9 commit 4e26646

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/client/request.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<B> Request<B> {
3333
/// Read the Request Uri.
3434
#[inline]
3535
pub fn uri(&self) -> &Uri { &self.uri }
36-
36+
3737
/// Read the Request Version.
3838
#[inline]
3939
pub fn version(&self) -> HttpVersion { self.version }
@@ -46,6 +46,10 @@ impl<B> Request<B> {
4646
#[inline]
4747
pub fn method(&self) -> &Method { &self.method }
4848

49+
/// Read the Request body.
50+
#[inline]
51+
pub fn body(&self) -> Option<&B> { self.body.as_ref() }
52+
4953
/// Set the Method of this request.
5054
#[inline]
5155
pub fn set_method(&mut self, method: Method) { self.method = method; }

0 commit comments

Comments
 (0)