use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class ProxyRequestHelperTests method shouldDebugBodyNullRequest.
@Test
public void shouldDebugBodyNullRequest() throws Exception {
RequestContext context = RequestContext.getCurrentContext();
ProxyRequestHelper helper = new ProxyRequestHelper();
assertThat("shouldDebugBody wrong", helper.shouldDebugBody(context), is(true));
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class ProxyRequestHelperTests method shouldDebugBodyChunked.
@Test
public void shouldDebugBodyChunked() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("POST", "/");
RequestContext context = RequestContext.getCurrentContext();
context.setChunkedRequestBody();
context.setRequest(request);
ProxyRequestHelper helper = new ProxyRequestHelper();
assertThat("shouldDebugBody wrong", helper.shouldDebugBody(context), is(false));
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class ProxyRequestHelperTests method buildZuulRequestURIWithDefaultEncoding.
@Test
public void buildZuulRequestURIWithDefaultEncoding() {
String encodedURI = "/resource/esp%E9cial-char";
String decodedURI = "/resource/espécial-char";
MockHttpServletRequest request = new MockHttpServletRequest("GET", encodedURI);
final RequestContext context = RequestContext.getCurrentContext();
context.setRequest(request);
context.set(REQUEST_URI_KEY, decodedURI);
final String requestURI = new ProxyRequestHelper().buildZuulRequestURI(request);
assertThat(requestURI, equalTo(encodedURI));
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class ServletFormRibbonClientConfiguration 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 RetryableRibbonClientConfiguration method setTestRequestContext.
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
Aggregations