mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
Do not encode zero-sized response bodies (#3199)
* Do not encode zero-sized response bodies * Test empty response remains empty after compression
This commit is contained in:
@ -6,6 +6,10 @@
|
||||
|
||||
- Updated `zstd` dependency to `0.13`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Do not encode zero-sized response bodies
|
||||
|
||||
## 3.4.0
|
||||
|
||||
### Added
|
||||
|
@ -52,7 +52,7 @@ impl<B: MessageBody> Encoder<B> {
|
||||
|
||||
pub fn response(encoding: ContentEncoding, head: &mut ResponseHead, body: B) -> Self {
|
||||
// no need to compress an empty body
|
||||
if matches!(body.size(), BodySize::None) {
|
||||
if matches!(body.size(), BodySize::None | BodySize::Sized(0)) {
|
||||
return Self::none();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user