mirror of https://github.com/fafhrd91/actix-web
Do not encode zero-sized response bodies
This commit is contained in:
parent
4accfab196
commit
438011dd72
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
- Updated `zstd` dependency to `0.13`.
|
- Updated `zstd` dependency to `0.13`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Do not encode zero-sized response bodies
|
||||||
|
|
||||||
## 3.4.0
|
## 3.4.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl<B: MessageBody> Encoder<B> {
|
||||||
|
|
||||||
pub fn response(encoding: ContentEncoding, head: &mut ResponseHead, body: B) -> Self {
|
pub fn response(encoding: ContentEncoding, head: &mut ResponseHead, body: B) -> Self {
|
||||||
// no need to compress an empty body
|
// 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();
|
return Self::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue