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