@Test public void test_should_set_correlation_id_response_header() { RequestContext.getCurrentContext().set("CORRELATION_ID", "someCorrelationId"); final MockHttpServletResponse response = new MockHttpServletResponse(); response.setStatus(400); RequestContext.getCurrentContext().setResponse(response); final MockHttpServletRequest request = new MockHttpServletRequest(); request.setRequestURI("http: RequestContext.getCurrentContext().setRequest(request); filter.run(); final List<Pair<String, String>> zuulResponseHeaders = RequestContext.getCurrentContext().getZuulResponseHeaders(); assertEquals(1, zuulResponseHeaders.size()); final Pair<String, String> stringPair = zuulResponseHeaders.get(0); assertEquals("x-correlation-id", stringPair.first()); assertEquals("someCorrelationId", stringPair.second()); }
@Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); ctx.addZuulResponseHeader(CORRELATION_HEADER_NAME, getCorrelationId()); return null; }
ResponseEnhancementFilter extends ZuulFilter { @Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); ctx.addZuulResponseHeader(CORRELATION_HEADER_NAME, getCorrelationId()); return null; } }
ResponseEnhancementFilter extends ZuulFilter { @Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); ctx.addZuulResponseHeader(CORRELATION_HEADER_NAME, getCorrelationId()); return null; }  }
ResponseEnhancementFilter extends ZuulFilter { @Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); ctx.addZuulResponseHeader(CORRELATION_HEADER_NAME, getCorrelationId()); return null; }  @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); }
ResponseEnhancementFilter extends ZuulFilter { @Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); ctx.addZuulResponseHeader(CORRELATION_HEADER_NAME, getCorrelationId()); return null; }  @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run();  }