stub recording should support Content-Encoding: deflate (compression)
#1,989 opened on Oct 17, 2022
Repository metrics
- Stars
- (5,766 stars)
- PR merge metrics
- (Avg merge 1d 15h) (33 merged PRs in 30d)
Description
Which version of WireMock you're using: 2.34.0
Steps to reproduce:
- Configure a server to compress content with content-encoding: deflate
- Record a conversation with this server
- Attempt to use this recorded conversation to play back a response
The problem is then that the recorded content is compressed, but the content-encoding: deflate header has been removed. http clients then do not attempt to decompress the content and it is unusable by the application.
This is due to a bug in SutbMappingJsonRecorder: withoutContentEncodingAndContentLength removes these headers always, but the bodyDecompressedIfRequired method only decompresses gzip content. So there is really one bug here (removing headers should be done only if the content encoding is understood and the content is decompressed) and one implied feature request (we should support deflate, it's pretty easy).