Describe the bug Linebreaks ("\n" or "\r") are been stripped out from gzip response body, when using response compression configuration (as below).
feign.compression.response.enabled: true feign.compression.response.useGzipDecoder: true
There are no errors raised. Linebreaks are just been replace by an empty string "". The response has the correct "content-encoding: gzip" header, and a well formed gzipped body content.
Same behaviour using Apache Http as client:
feign.httpclient.enabled: true
Versions:
org.springframework.boot: 2.3.3.RELEASE org.springframework.cloud: Hoxton.SR8
Sample I use wiremock in the example, but it's not an wiremock problem. A first caught the problem in a "real" application.
I replaced the Spring Cloud Open Feign with the Java 11 Http Client from example below in the real scenario: https://golb.hplar.ch/2019/01/java-11-http-client.html
@Test
void failed_GzipLineBreak() {
stubFor(get(urlEqualTo("/gzip"))
.withHeader("Accept-Encoding", containing("gzip"))
.willReturn(aResponse()
.withStatus(200)
.withBody("lineone\nlinetwo")));
String response = springCloudFeignClient.getGzippedString();
assertEquals("lineone\nlinetwo", response); //fail
}
@Test
void success_GzipOneLine() {
stubFor(get(urlEqualTo("/gzip"))
.withHeader("Accept-Encoding", containing("gzip"))
.willReturn(aResponse()
.withStatus(200)
.withBody("lineone")));
String response = springCloudFeignClient.getGzippedString();
assertEquals("lineone", response); //success
}
Minimalist project example attached. spring-cloud-feign-gzip.zip
Comment From: spencergibb
Closing in favor of stack overflow. https://stackoverflow.com/q/63661538/2730527
Comment From: gstabel
@spencergibb, closing in favor of my questions in Stack Overflow won't make the community here lose track of the of issue? How do you get track of open issues than? Thank you for your reply!