Commit ddd1b35b by Dave Syer

Merge branch '1.0.x'

parents e8b0e613 ad86d48c
...@@ -30,16 +30,18 @@ import java.util.Set; ...@@ -30,16 +30,18 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.boot.actuate.trace.TraceRepository; import org.springframework.boot.actuate.trace.TraceRepository;
import org.springframework.http.HttpHeaders;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.util.UriUtils;
import org.springframework.web.util.WebUtils;
import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.util.HTTPRequestUtils; import com.netflix.zuul.util.HTTPRequestUtils;
import org.springframework.web.util.UriUtils;
import org.springframework.web.util.WebUtils;
/** /**
* @author Dave Syer * @author Dave Syer
...@@ -93,17 +95,17 @@ public class ProxyRequestHelper { ...@@ -93,17 +95,17 @@ public class ProxyRequestHelper {
public MultiValueMap<String, String> buildZuulRequestHeaders( public MultiValueMap<String, String> buildZuulRequestHeaders(
HttpServletRequest request) { HttpServletRequest request) {
RequestContext context = RequestContext.getCurrentContext(); RequestContext context = RequestContext.getCurrentContext();
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); MultiValueMap<String, String> headers = new HttpHeaders();
Enumeration<String> headerNames = request.getHeaderNames(); Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) { if (headerNames != null) {
while (headerNames.hasMoreElements()) { while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement(); String name = headerNames.nextElement();
if (isIncludedHeader(name)) { if (isIncludedHeader(name)) {
Enumeration<String> values = request.getHeaders(name); Enumeration<String> values = request.getHeaders(name);
while (values.hasMoreElements()) { while (values.hasMoreElements()) {
String value = values.nextElement(); String value = values.nextElement();
headers.add(name, value); headers.add(name, value);
} }
} }
} }
} }
...@@ -111,7 +113,7 @@ public class ProxyRequestHelper { ...@@ -111,7 +113,7 @@ public class ProxyRequestHelper {
for (String header : zuulRequestHeaders.keySet()) { for (String header : zuulRequestHeaders.keySet()) {
headers.set(header, zuulRequestHeaders.get(header)); headers.set(header, zuulRequestHeaders.get(header));
} }
headers.set("accept-encoding", "gzip"); headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip");
return headers; return headers;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment