From d85468f7e107ef5116e3fad40dc9b9ed57bfdb04 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 5 Mar 2019 19:07:07 -0800 Subject: [PATCH] do not expose headers_mut via HttpMessage --- src/client/response.rs | 4 ---- src/httpmessage.rs | 8 -------- src/request.rs | 10 +++++----- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/client/response.rs b/src/client/response.rs index 236a6338..7c6cdf64 100644 --- a/src/client/response.rs +++ b/src/client/response.rs @@ -24,10 +24,6 @@ impl HttpMessage for ClientResponse { &self.head.headers } - fn headers_mut(&mut self) -> &mut HeaderMap { - &mut self.head.headers - } - fn extensions(&self) -> Ref { self.head.extensions() } diff --git a/src/httpmessage.rs b/src/httpmessage.rs index d95f82f5..3c049c09 100644 --- a/src/httpmessage.rs +++ b/src/httpmessage.rs @@ -32,9 +32,6 @@ pub trait HttpMessage: Sized { /// Read the message headers. fn headers(&self) -> &HeaderMap; - /// Mutable reference to the message's headers. - fn headers_mut(&mut self) -> &mut HeaderMap; - /// Message payload stream fn take_payload(&mut self) -> Payload; @@ -280,11 +277,6 @@ where (**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() diff --git a/src/request.rs b/src/request.rs index 761a159d..0ea251ea 100644 --- a/src/request.rs +++ b/src/request.rs @@ -22,11 +22,6 @@ impl

HttpMessage for Request

{ &self.head().headers } - #[inline] - fn headers_mut(&mut self) -> &mut HeaderMap { - &mut self.head_mut().headers - } - /// Request extensions #[inline] fn extensions(&self) -> Ref { @@ -107,6 +102,11 @@ impl

Request

{ &mut *self.head } + /// Mutable reference to the message's headers. + fn headers_mut(&mut self) -> &mut HeaderMap { + &mut self.head_mut().headers + } + /// Request's uri. #[inline] pub fn uri(&self) -> &Uri {