use of org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository in project spring-cloud-netflix by spring-cloud.
the class ProxyRequestHelperTests method debug.
@Test
public void debug() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("POST", "/");
request.setContent("{}".getBytes());
request.addHeader("singleName", "singleValue");
request.addHeader("multiName", "multiValue1");
request.addHeader("multiName", "multiValue2");
RequestContext.getCurrentContext().setRequest(request);
TraceProxyRequestHelper helper = new TraceProxyRequestHelper();
this.traceRepository = new InMemoryHttpTraceRepository();
helper.setTraces(this.traceRepository);
MultiValueMap<String, String> headers = helper.buildZuulRequestHeaders(request);
helper.debug("POST", "http://example.com", headers, new LinkedMultiValueMap<>(), request.getInputStream());
HttpTrace actual = this.traceRepository.findAll().get(0);
Assertions.assertThat(actual.getRequest().getHeaders()).containsKeys("singleName", "multiName");
}
Aggregations