Browse Source

Removed deflate accept-encoding from outbound requests

pull/6/head
Brandon Atkinson 10 years ago committed by Spencer Gibb
parent
commit
80206e6b38
  1. 2
      spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java
  2. 21
      spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java

2
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelper.java

@ -93,7 +93,7 @@ public class ProxyRequestHelper { @@ -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;
}

21
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/ProxyRequestHelperTests.java

@ -16,8 +16,6 @@ @@ -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; @@ -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 { @@ -65,4 +65,19 @@ public class ProxyRequestHelperTests {
assertThat(missingName, is(nullValue()));
}
@Test
public void buildZuulRequestHeadersRequestsGzipAndOnlyGzip() {
MockHttpServletRequest request = new MockHttpServletRequest("", "/");
ProxyRequestHelper helper = new ProxyRequestHelper();
MultiValueMap<String, String> headers = helper.buildZuulRequestHeaders(request);
List<String> acceptEncodings = headers.get("accept-encoding");
assertThat(acceptEncodings, hasSize(1));
assertThat(acceptEncodings, contains("gzip"));
}
}

Loading…
Cancel
Save