Skip to content
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

fix: HttpResponse GZip content encoding equality change #843

Merged
Expand Up @@ -80,6 +80,12 @@ public final class HttpResponse {
/** Whether {@link #getContent()} should return raw input stream. */
private final boolean returnRawInputStream;

/** Content encoding for GZip */
private static final String CONTENT_ENCODING_GZIP = "gzip";

/** Content encoding for GZip HTTP 1.1 */
private static final String CONTENT_ENCODING_XGZIP = "x-gzip";
egsavage marked this conversation as resolved.
Show resolved Hide resolved

/**
* Determines the limit to the content size that will be logged during {@link #getContent()}.
*
Expand Down Expand Up @@ -330,7 +336,8 @@ public InputStream getContent() throws IOException {
String contentEncoding = this.contentEncoding;
egsavage marked this conversation as resolved.
Show resolved Hide resolved
if (!returnRawInputStream
&& contentEncoding != null
&& contentEncoding.contains("gzip")) {
&& (CONTENT_ENCODING_GZIP.equalsIgnoreCase(contentEncoding.trim())
egsavage marked this conversation as resolved.
Show resolved Hide resolved
|| CONTENT_ENCODING_XGZIP.equalsIgnoreCase(contentEncoding.trim()))) {
lowLevelResponseContent = new GZIPInputStream(lowLevelResponseContent);
}
// logging (wrap content with LoggingInputStream)
Expand Down