diff --git a/src/httpmessage.rs b/src/httpmessage.rs index 17447af63..d95f82f5d 100644 --- a/src/httpmessage.rs +++ b/src/httpmessage.rs @@ -270,6 +270,37 @@ pub trait HttpMessage: Sized { } } +impl<'a, T> HttpMessage for &'a mut T +where + T: HttpMessage, +{ + type Stream = T::Stream; + + fn headers(&self) -> &HeaderMap { + (**self).headers() + } + + /// Mutable reference to the message's headers. + fn headers_mut(&mut self) -> &mut HeaderMap { + (**self).headers_mut() + } + + /// Message payload stream + fn take_payload(&mut self) -> Payload { + (**self).take_payload() + } + + /// Request's extensions container + fn extensions(&self) -> Ref { + (**self).extensions() + } + + /// Mutable reference to a the request's extensions container + fn extensions_mut(&self) -> RefMut { + (**self).extensions_mut() + } +} + /// Stream to read request line by line. pub struct Readlines { stream: Payload,