New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The default client with URLConnection doesn't work with gzipped response #934
Comments
I suspect that compression is out-of-scope for any of the clients without additional configuration. I'll look it over. |
The default client does support GZIP if you set the appropriate |
@kdavisk6 The Accept-Encoding header has been automatically set to 'gzip, deflate'. 'Content-Encoding' may not related to this issue at all. I created a simple demo repo at https://github.com/flyingzhang/feign-client-compress-demo for this. When response is gzipped, exception will be thrown on feign's decoding. Apparently this is somehow JRE related. In my environment armed with oracle 8u144, testing show that URLConnection can automatically decompress 'deflate' body, but won't handle the 'gzipped' response. I will test whether some latest jre can handle it well. |
Same here.
After adding @headers("Accept-Encoding: gzip") to the request method. I'm using the <dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>11.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>11.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
<version>11.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-mock</artifactId>
<version>11.0</version>
<scope>test</scope>
</dependency> |
I believe I may have finally found the issue here. It appears that we need to wrap the the response input stream into a |
This change updates the Input Stream handling when using the Default client implementation to detect when a response is `gzipped` and wrap it in a `GZipInputStream`. This addresses any issues related to compression when using the default client.
This change updates the Input Stream handling when using the Default client implementation to detect when a response is `gzipped` and wrap it in a `GZipInputStream`. This addresses any issues related to compression when using the default client.
This change updates the Input Stream handling when using the Default client implementation to detect when a response is `gzipped` and wrap it in a `GZipInputStream`. This addresses any issues related to compression when using the default client.
Fixes: #934, #1208 This change updates the Input Stream handling when using the Default client implementation to detect when a response is `gzipped` and wrap it in a `GZipInputStream`. This addresses any issues related to compression when using the default client. In addition, removed the implicit parsing of the body during toString. This was also brought up in #1208 and it came up during testing of this change. Users should be using our `asReader` and other methods to access the response body. * Adding Deflate support * Added Deflate Support and removed implicit response body reading * Refactored Gzip and Deflate Conditions * Corrected formatting and line-endings
Hi,
I am using openfeign with spring-cloud-starter-openfeign 2.1.1.RELEASE, the openfeign components included are of version 10.1.0. My question is that seems the default client doesn't take the response of decompress response body. This behavior caused some decoder exception like below:
I am not quite sure should I try to adapt the compressed response in a Client.Default, or just turn to other client implementation likes feign-httpclient? Thanks for any clarification.
The text was updated successfully, but these errors were encountered: