feign
feign copied to clipboard
GZIP body decompression before decoding through logging side effect
While upgrading Feign in SC OpenFeign to versions: 11.1, 11.2 (btw., I can't see this tag in repo, but the artifact is present in mvn), I have stumbled upon an issue:
When GZIP
is set as CONTENT-ENCODING
, the response body is now being wrapped with GZIPInputStream
. When logging is not enabled, a response this GZIPInputStream
body is then passed to decoders for further handling.
However, when logging is enabled, the GZIP body is decompressed here (through calling read(byte[] buf, int off, int len)
from java.util.zip.GZIPInputStream.java
) and then this decompressed byte array is set as response body here.
While upgrading Feign in SC OpenFeign to versions: 11.1, 11.2 (btw., I can't see this tag in repo, but the artifact is present in mvn)
This is odd I can see it fine: https://github.com/OpenFeign/feign/releases/tag/11.2
Right, my bad: the tag is there; it's the release notes that are missing; sorry for the confusion.
This side-effect has come up a few times. I wonder if we need to reconsider this approach, or at least make it clear that logging will read the response and potentially re-wrap.