mirror of https://github.com/fafhrd91/actix-web
remove conditional test code
This commit is contained in:
parent
de807ff6b1
commit
4e56418eda
|
@ -32,6 +32,7 @@
|
|||
[#2956]: https://github.com/actix/actix-web/pull/2956
|
||||
[#2968]: https://github.com/actix/actix-web/pull/2968
|
||||
|
||||
|
||||
## 3.2.2 - 2022-09-11
|
||||
### Changed
|
||||
- Minimum supported Rust version (MSRV) is now 1.59 due to transitive `time` dependency.
|
||||
|
|
|
@ -19,7 +19,6 @@ use h2::{
|
|||
server::{Connection, SendResponse},
|
||||
Ping, PingPong,
|
||||
};
|
||||
use http::Method;
|
||||
use pin_project_lite::pin_project;
|
||||
use tracing::{error, trace, warn};
|
||||
|
||||
|
@ -30,7 +29,7 @@ use crate::{
|
|||
HeaderName, HeaderValue, CONNECTION, CONTENT_LENGTH, DATE, TRANSFER_ENCODING, UPGRADE,
|
||||
},
|
||||
service::HttpFlow,
|
||||
Extensions, OnConnectData, Payload, Request, Response, ResponseHead,
|
||||
Extensions, Method, OnConnectData, Payload, Request, Response, ResponseHead,
|
||||
};
|
||||
|
||||
const CHUNK_SIZE: usize = 16_384;
|
||||
|
@ -218,14 +217,14 @@ where
|
|||
// prepare response.
|
||||
let mut size = body.size();
|
||||
let res = prepare_response(config, res.head(), &mut size);
|
||||
let eof = size.is_eof() || head_req;
|
||||
let eof_or_head = size.is_eof() || head_req;
|
||||
|
||||
// send response head and return on eof.
|
||||
let mut stream = tx
|
||||
.send_response(res, eof)
|
||||
.send_response(res, eof_or_head)
|
||||
.map_err(DispatchError::SendResponse)?;
|
||||
|
||||
if eof {
|
||||
if eof_or_head {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
@ -126,15 +126,7 @@ where
|
|||
};
|
||||
|
||||
let (parts, body) = resp.into_parts();
|
||||
let payload = if cfg!(test) {
|
||||
body.into()
|
||||
} else {
|
||||
if head_req {
|
||||
Payload::None
|
||||
} else {
|
||||
body.into()
|
||||
}
|
||||
};
|
||||
let payload = if head_req { Payload::None } else { body.into() };
|
||||
|
||||
let mut head = ResponseHead::new(parts.status);
|
||||
head.version = parts.version;
|
||||
|
|
Loading…
Reference in New Issue