diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java index dce47fe6..1fc153d7 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java @@ -93,7 +93,7 @@ public class ProxyRequestHelper { for (String header : zuulRequestHeaders.keySet()) { headers.set(header, zuulRequestHeaders.get(header)); } - headers.set("accept-encoding", "deflate, gzip"); + headers.set("accept-encoding", "gzip"); return headers; } diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java index 5a80d53c..1c03ee9f 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java @@ -16,8 +16,6 @@ package org.springframework.cloud.netflix.zuul.filters; -import java.util.List; - import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -25,8 +23,10 @@ import org.springframework.boot.actuate.trace.TraceRepository; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.util.MultiValueMap; -import static org.junit.Assert.*; +import java.util.List; + import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThat; import static org.mockito.MockitoAnnotations.initMocks; /** @@ -65,4 +65,19 @@ public class ProxyRequestHelperTests { assertThat(missingName, is(nullValue())); } + + @Test + public void buildZuulRequestHeadersRequestsGzipAndOnlyGzip() { + MockHttpServletRequest request = new MockHttpServletRequest("", "/"); + + ProxyRequestHelper helper = new ProxyRequestHelper(); + + MultiValueMap headers = helper.buildZuulRequestHeaders(request); + + List acceptEncodings = headers.get("accept-encoding"); + assertThat(acceptEncodings, hasSize(1)); + assertThat(acceptEncodings, contains("gzip")); + } + + }