diff --git a/src/client/pipeline.rs b/src/client/pipeline.rs index fbbce4546..9828478cd 100644 --- a/src/client/pipeline.rs +++ b/src/client/pipeline.rs @@ -17,6 +17,7 @@ use context::{ActorHttpContext, Frame}; use error::Error; use error::PayloadError; use header::ContentEncoding; +use http::Method; use httpmessage::HttpMessage; use server::input::PayloadStream; use server::WriterState; @@ -212,6 +213,9 @@ impl Future for SendRequest { match pl.parse() { Ok(Async::Ready(mut resp)) => { + if self.req.method() == &Method::HEAD { + pl.parser.take(); + } resp.set_pipeline(pl); return Ok(Async::Ready(resp)); } diff --git a/tests/test_server.rs b/tests/test_server.rs index 4fb73a6a5..4c50434c2 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -368,8 +368,8 @@ fn test_head_empty() { } // read response - // let bytes = srv.execute(response.body()).unwrap(); - // assert!(bytes.is_empty()); + let bytes = srv.execute(response.body()).unwrap(); + assert!(bytes.is_empty()); } #[test] @@ -396,8 +396,8 @@ fn test_head_binary() { } // read response - //let bytes = srv.execute(response.body()).unwrap(); - //assert!(bytes.is_empty()); + let bytes = srv.execute(response.body()).unwrap(); + assert!(bytes.is_empty()); } #[test]