-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
help wantedIssues we need help with tacklingIssues we need help with tacklingproposalProposed Specification or API changeProposed Specification or API change
Description
The issue exists in OpenFeign 11.8, but it was working in 10.x.
Client.java
@Override
public Response execute(Request request, Options options) throws IOException {
HttpURLConnection connection = convertAndSend(request, options);
return convertResponse(connection, request);
}
Response convertResponse(HttpURLConnection connection, Request request) throws IOException {
int status = connection.getResponseCode();
String reason = connection.getResponseMessage();
...
InputStream stream;
if (status >= 400) {
stream = connection.getErrorStream();
} else {
if (this.isGzip(connection.getHeaderFields().get(CONTENT_ENCODING))) {
stream = new GZIPInputStream(connection.getInputStream());
} else if (this.isDeflate(connection.getHeaderFields().get(CONTENT_ENCODING))) {
stream = new InflaterInputStream(connection.getInputStream());
} else {
stream = connection.getInputStream();
}
}
...
}
ApacheHttpClient.java
public final class ApacheHttpClient implements Client {
private static final String ACCEPT_HEADER_NAME = "Accept";
private final HttpClient client;
...
@Override
public Response execute(Request request, Request.Options options) throws IOException {
HttpUriRequest httpUriRequest;
try {
httpUriRequest = toHttpUriRequest(request, options);
} catch (URISyntaxException e) {
throw new IOException("URL '" + request.url() + "' couldn't be parsed into a URI", e);
}
HttpResponse httpResponse = client.execute(httpUriRequest);
return toFeignResponse(httpResponse, request);
}
If any client is used other than the default client, the GZIP content can't be decoded and results in an exception, because GZIP is read as simple InputStream, not GZIPInputStream
feign.codec.DecodeException: Error while extracting response for type [java.util.List<ProductDto>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens; nested exception is com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens
Metadata
Metadata
Assignees
Labels
help wantedIssues we need help with tacklingIssues we need help with tacklingproposalProposed Specification or API changeProposed Specification or API change