1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-18 05:41:50 +01:00

Modify response body only if encoder is not None #997

This commit is contained in:
Nikolay Kim 2019-07-22 11:35:00 +06:00
parent b0b462581b
commit f3751d83f8
2 changed files with 23 additions and 15 deletions

View File

@ -1,5 +1,11 @@
# Changes # Changes
## [0.2.8] - 2019-07-xx
### Fixed
* Invalid response with compression middleware enabled, but compression-related features disabled #997
## [0.2.7] - 2019-07-18 ## [0.2.7] - 2019-07-18
### Added ### Added

View File

@ -54,15 +54,18 @@ impl<B: MessageBody> Encoder<B> {
}; };
if can_encode { if can_encode {
// Modify response body only if encoder is not None
if let Some(enc) = ContentEncoder::encoder(encoding) {
update_head(encoding, head); update_head(encoding, head);
head.no_chunking(false); head.no_chunking(false);
ResponseBody::Body(Encoder { return ResponseBody::Body(Encoder {
body, body,
eof: false, eof: false,
fut: None, fut: None,
encoder: ContentEncoder::encoder(encoding), encoder: Some(enc),
}) });
} else { }
}
ResponseBody::Body(Encoder { ResponseBody::Body(Encoder {
body, body,
eof: false, eof: false,
@ -70,7 +73,6 @@ impl<B: MessageBody> Encoder<B> {
encoder: None, encoder: None,
}) })
} }
}
} }
enum EncoderBody<B> { enum EncoderBody<B> {