diff --git a/src/encoding.rs b/src/encoding.rs index 2fef7a49..c6fffa8b 100644 --- a/src/encoding.rs +++ b/src/encoding.rs @@ -459,7 +459,10 @@ impl PayloadEncoder { } else { resp.headers.insert(CONNECTION, HeaderValue::from_static("upgrade")); } - encoding = ContentEncoding::Identity; + if encoding != ContentEncoding::Identity { + encoding = ContentEncoding::Identity; + resp.headers.remove(CONTENT_ENCODING); + } TransferEncoding::eof() } };