use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class PreDecorationFilterTests method sensitiveHeadersOverrideEmpty.
@Test
public void sensitiveHeadersOverrideEmpty() throws Exception {
this.properties.setPrefix("/api");
this.properties.setStripPrefix(true);
this.properties.setSensitiveHeaders(Collections.singleton("x-bar"));
this.request.setRequestURI("/api/foo/1");
ZuulRoute route = new ZuulRoute("/foo/**", "foo");
route.setSensitiveHeaders(Collections.<String>emptySet());
this.routeLocator.addRoute(route);
this.filter.run();
RequestContext ctx = RequestContext.getCurrentContext();
@SuppressWarnings("unchecked") Set<String> sensitiveHeaders = (Set<String>) ctx.get(ProxyRequestHelper.IGNORED_HEADERS);
assertTrue("sensitiveHeaders is wrong: " + sensitiveHeaders, sensitiveHeaders.isEmpty());
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class PreDecorationFilterTests method prefixRouteWithRouteStrippingAddsHeader.
@Test
public void prefixRouteWithRouteStrippingAddsHeader() throws Exception {
this.properties.setPrefix("/api");
this.properties.setStripPrefix(true);
this.request.setRequestURI("/api/foo/1");
this.routeLocator.addRoute("/foo/**", "foo");
this.filter.run();
RequestContext ctx = RequestContext.getCurrentContext();
assertEquals("/1", ctx.get(REQUEST_URI_KEY));
assertEquals("localhost", ctx.getZuulRequestHeaders().get("x-forwarded-host"));
assertEquals("http", ctx.getZuulRequestHeaders().get("x-forwarded-proto"));
assertEquals("/api/foo", ctx.getZuulRequestHeaders().get("x-forwarded-prefix"));
assertEquals("foo", getHeader(ctx.getOriginResponseHeaders(), "x-zuul-serviceid"));
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class EagerLoadOfZuulConfigurationTests method setTestRequestContext.
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class LazyLoadOfZuulConfigurationTests method setTestRequestContext.
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class SendForwardFilterTests method setTestRequestcontext.
@Before
public void setTestRequestcontext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
Aggregations