From 4e26646aa7b46d5739d3978126bb70e8c47cde1d Mon Sep 17 00:00:00 2001 From: James Kay Date: Wed, 19 Apr 2017 17:39:28 +0100 Subject: [PATCH] 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. --- src/client/request.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/request.rs b/src/client/request.rs index da91320fb5..a17e614fca 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -33,7 +33,7 @@ impl Request { /// Read the Request Uri. #[inline] pub fn uri(&self) -> &Uri { &self.uri } - + /// Read the Request Version. #[inline] pub fn version(&self) -> HttpVersion { self.version } @@ -46,6 +46,10 @@ impl Request { #[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; }