Skip to content

Commit 032f71d

Browse files
committed
Keep content-encoding in response content interceptor
This solves issues with gzip encoded content where the encoding was missing after the interceptor. This has to be handled in apache http v5 because ByteArrayEntity now requires a non null content encoding to make sure the encoding is preserved. Apache will decompress the gzip automaticalyly if content encoding is set to gzip.
1 parent 36a155d commit 032f71d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/no/digipost/api/client/internal/http/response/interceptor/ResponseContentSHA256Interceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void process(HttpResponse response, EntityDetails entityDetails, HttpCont
5252
X_Content_SHA256, response.getCode())));
5353
byte[] entityBytes = EntityUtils.toByteArray(entity);
5454
validerBytesMotHashHeader(hashHeaderValue, entityBytes);
55-
classicHttpResponse.setEntity(new ByteArrayEntity(entityBytes, ContentType.parse(entityDetails.getContentType())));
55+
classicHttpResponse.setEntity(new ByteArrayEntity(entityBytes, ContentType.parse(entityDetails.getContentType()), entityDetails.getContentEncoding()));
5656
}
5757
}
5858

0 commit comments

Comments
 (0)