mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 05:41:50 +01:00
do not read head payload
This commit is contained in:
parent
2a25caf2c5
commit
9070d59ea8
@ -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));
|
||||
}
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user