mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 15:07:42 +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:
@ -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