feign icon indicating copy to clipboard operation
feign copied to clipboard

HC5 client can't send compressed POST requests

Open fbus opened this issue 3 years ago • 1 comments

ApacheHttp5Client does not check if there is an 'Accept-Encoding' header when building the HttpRequest

https://github.com/OpenFeign/feign/blob/885f3e3400e564c8a4aa2642629452e9604c552e/hc5/src/main/java/feign/hc5/ApacheHttp5Client.java#L124C12-L124C12

when there is a gzip header, it should create a GzipCompressingEntity to wrap the StringEntity / ByteArrayEntity.

Because of this, the body is not compressed, while my request has an 'Accept-Encoding: gzip' header. And the server replies with a '500 Not in GZIP format' error.

fbus avatar Nov 27 '23 08:11 fbus

as far as I can tell, the default Client is the only one handling properly this case : https://github.com/fbus/feign/blob/885f3e3400e564c8a4aa2642629452e9604c552e/core/src/main/java/feign/Client.java#L225-L226 OkHttp and HC4 are doint have the same bug as hc5

fbus avatar Nov 27 '23 09:11 fbus