wiremock/wiremock

stub recording should support Content-Encoding: deflate (compression)

Open

#1,989 opened on Oct 17, 2022

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Java (5,766 stars) (1,368 forks)batch import
enhancementhelp wanted

Description

Which version of WireMock you're using: 2.34.0

Steps to reproduce:

  1. Configure a server to compress content with content-encoding: deflate
  2. Record a conversation with this server
  3. 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).

Contributor guide