From 4e56418edaa24226668590ce5b3232acfe1a84c2 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 21 Jan 2023 00:15:17 +0000 Subject: [PATCH] remove conditional test code --- actix-http/CHANGES.md | 1 + actix-http/src/h2/dispatcher.rs | 9 ++++----- awc/src/client/h2proto.rs | 10 +--------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 56e10ef5e..fa254ccf2 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -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. diff --git a/actix-http/src/h2/dispatcher.rs b/actix-http/src/h2/dispatcher.rs index 646757fd3..3e618820e 100644 --- a/actix-http/src/h2/dispatcher.rs +++ b/actix-http/src/h2/dispatcher.rs @@ -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(()); } diff --git a/awc/src/client/h2proto.rs b/awc/src/client/h2proto.rs index b04892810..709896ddd 100644 --- a/awc/src/client/h2proto.rs +++ b/awc/src/client/h2proto.rs @@ -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;