use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class PatternServiceRouteMapperTests 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 LocationRewriteFilterTests method shouldNotAddBackGlobalPrefixIfNotStripped.
@Test
public void shouldNotAddBackGlobalPrefixIfNotStripped() {
RequestContext context = RequestContext.getCurrentContext();
ZuulProperties zuulProperties = new ZuulProperties();
zuulProperties.setPrefix("global");
zuulProperties.setStripPrefix(false);
LocationRewriteFilter filter = setFilterUpWith(context, zuulProperties, new Route("service1", "/something/redirectingUri", "service1", "prefix", false, Collections.EMPTY_SET, true), "/global/prefix/redirectingUri", "/global/something/redirectedUri;someparam?param1=abc");
filter.run();
assertThat(getLocationHeader(context).second()).isEqualTo(String.format("%s/global/prefix/something/redirectedUri;someparam?param1=abc", ZUUL_BASE_URL));
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class LocationRewriteFilterTests method before.
@Before
public void before() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class LocationRewriteFilterTests method shouldRewriteLocationHeadersIfPrefixIsEmpty.
@Test
public void shouldRewriteLocationHeadersIfPrefixIsEmpty() {
RequestContext context = RequestContext.getCurrentContext();
ZuulProperties zuulProperties = new ZuulProperties();
LocationRewriteFilter filter = setFilterUpWith(context, zuulProperties, new Route("service1", "/something/redirectingUri", "service1", "", false, Collections.EMPTY_SET, true), "/redirectingUri", "/something/redirectedUri;someparam?param1=abc");
filter.run();
assertThat(getLocationHeader(context).second()).isEqualTo(String.format("%s/something/redirectedUri;someparam?param1=abc", ZUUL_BASE_URL));
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class LocationRewriteFilterTests method shouldRewriteLocationHeadersWithRoutePrefix.
@Test
public void shouldRewriteLocationHeadersWithRoutePrefix() {
RequestContext context = RequestContext.getCurrentContext();
ZuulProperties zuulProperties = new ZuulProperties();
LocationRewriteFilter filter = setFilterUpWith(context, zuulProperties, new Route("service1", "/redirectingUri", "service1", "prefix", false, Collections.EMPTY_SET, true), "/prefix/redirectingUri", "/redirectedUri;someparam?param1=abc");
filter.run();
assertThat(getLocationHeader(context).second()).isEqualTo(String.format("%s/prefix/redirectedUri;someparam?param1=abc", ZUUL_BASE_URL));
}
Aggregations