1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-02 13:29:24 +00: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
## [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
### Added

View file

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