1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-03 08:41:55 +00:00

do not read head payload

This commit is contained in:
Nikolay Kim 2018-07-06 08:11:36 +06:00
parent 2a25caf2c5
commit 9070d59ea8
2 changed files with 8 additions and 4 deletions

View file

@ -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));
}

View file

@ -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]