1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-02 21:39:26 +00:00

Do not encode zero-sized response bodies

This commit is contained in:
Paul Hooijenga 2023-11-22 15:44:13 +01:00
parent 4accfab196
commit 438011dd72
2 changed files with 5 additions and 1 deletions

View file

@ -6,6 +6,10 @@
- Updated `zstd` dependency to `0.13`.
### Fixed
- Do not encode zero-sized response bodies
## 3.4.0
### Added

View file

@ -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();
}