Java Code Examples for com.netflix.zuul.context.RequestContext

The following examples show how to use com.netflix.zuul.context.RequestContext. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private String rewriteBasePath(RequestContext context) {
    InputStream responseDataStream = context.getResponseDataStream();
    String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI();
    try {
        String response = CharStreams.toString(new InputStreamReader(responseDataStream));
        if (response != null) {
            LinkedHashMap<String, Object> map = this.mapper.readValue(response, LinkedHashMap.class);

            String basePath = requestUri.replace(Swagger2Controller.DEFAULT_URL,"");
            map.put("basePath",basePath);
            log.debug("Swagger-docs: rewritten Base URL with correct micro-service route: {}", basePath);
            return mapper.writeValueAsString(map);
        }
    }
    catch (IOException e){
        log.error("Swagger-docs filter error", e);
    }
    return null;
}
 
Example 2
@Override
public Object run() {
    try {
        RequestContext currentContext = RequestContext.getCurrentContext();
        HttpServletResponse response = currentContext.getResponse();

        if (!this.rateLimiter.tryAcquire()) {
            response.setStatus(HttpStatus.TOO_MANY_REQUESTS.value());
            response.getWriter().append(HttpStatus.TOO_MANY_REQUESTS.getReasonPhrase());
            currentContext.setSendZuulResponse(false);
        }
    } catch (IOException e) {
        ReflectionUtils.rethrowRuntimeException(e);
    }
    return null;
}
 
Example 3
@SuppressWarnings("unchecked")
protected List<Policy> policy(Route route, HttpServletRequest request) {
    List<Policy> policies = (List<Policy>) RequestContext.getCurrentContext().get(CURRENT_REQUEST_POLICY);
    if (policies != null) {
        return policies;
    }

    String routeId = route != null ? route.getId() : null;

    RequestContext.getCurrentContext().put(ALREADY_LIMITED, false);

    policies = properties.getPolicies(routeId).stream()
            .filter(policy -> applyPolicy(request, route, policy))
            .collect(Collectors.toList());

    addObjectToCurrentRequestContext(CURRENT_REQUEST_POLICY, policies);

    return policies;
}
 
Example 4
@Override
public Object run() throws ZuulException {
    RequestContext ctx = RequestContext.getCurrentContext();
    HttpServletRequest request = ctx.getRequest();
    log.info(String.format("header-token:%s,param-token:%s", request.getHeader("token"), request.getParameter("token")));
    String token_header = request.getHeader("token") == null ? "" : request.getHeader("token");
    String token_param = request.getParameter("token") == null ? "" : request.getParameter("token");
    if (token_header.equals("") && token_param.equals("")) {
        try {
            ctx.setSendZuulResponse(false);
            ctx.getResponse().getWriter().write("{\"code\": 9999,\"message\": \"token is empty.\"}");
        } catch (Exception e) {
            log.warning("system error");
        }

    } else if (!token_header.equals("")) {
        log.info(String.format("token is %s", token_header));
    } else if (!token_param.equals("")) {
        log.info(String.format("token is %s", token_param));
    }
    return null;
}
 
Example 5
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 6
@BeforeEach
public void setUp() {
    MockitoAnnotations.initMocks(this);
    CounterFactory.initialize(new EmptyCounterFactory());

    when(httpServletRequest.getContextPath()).thenReturn("");
    when(httpServletRequest.getRequestURI()).thenReturn("/servicea/test");
    when(httpServletRequest.getRemoteAddr()).thenReturn("127.0.0.1");
    RequestContext requestContext = new RequestContext();
    requestContext.setRequest(httpServletRequest);
    requestContext.setResponse(httpServletResponse);
    RequestContext.testSetCurrentContext(requestContext);
    RequestContextHolder.setRequestAttributes(requestAttributes);
    rateLimitProperties = new RateLimitProperties();
    rateLimitProperties.setAddResponseHeaders(false);
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    RateLimitUtils rateLimitUtils = new DefaultRateLimitUtils(rateLimitProperties);
    Route route = new Route("servicea", "/test", "servicea", "/servicea", null, Collections.emptySet());
    TestRouteLocator routeLocator = new TestRouteLocator(Collections.emptyList(), Lists.newArrayList(route));
    target = new RateLimitPreFilter(rateLimitProperties, routeLocator, urlPathHelper, rateLimiter, rateLimitKeyGenerator, rateLimitUtils, eventPublisher);
}
 
Example 7
Source Project: micro-service   Source File: ErrorFilter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        //HttpServletResponse response = ctx.getResponse();
        
        log.info("进入错误异常的过滤器!");
        
        log.info("===============");
        
//        log.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString()));
//        System.out.println(request.getRequestURL());
        
//        Object accessToken = request.getParameter("accessToken");
//        if(accessToken == null) {
//            log.warn("access token is empty");
//            ctx.setSendZuulResponse(false);
//            ctx.setResponseStatusCode(401);
//            return null;
//        }
//        log.info("access token ok");
        return null;
    }
 
Example 8
@Override
public Object run() {
    String id = getId(RequestContext.getCurrentContext().getRequest());
    Date date = getPeriod();

    // check current rate limit
    // default limit per user is 100,000 API calls per hour
    Long count = rateLimitingRepository.getCounter(id, TIME_PERIOD, date);
    log.debug("Rate limiting for user {} at {} - {}",  id, date, count);
    if (count > rateLimit) {
        apiLimitExceeded();
    } else {
        // count calls per hour
        rateLimitingRepository.incrementCounter(id, TIME_PERIOD, date);
    }
    return null;
}
 
Example 9
/**
 * Filter requests on endpoints that are not in the list of authorized microservices endpoints.
 */
@Override
public boolean shouldFilter() {
    String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI();

    // If the request Uri does not start with the path of the authorized endpoints, we block the request
    for (Route route : routeLocator.getRoutes()) {
        String serviceUrl = route.getFullPath();
        String serviceName = route.getId();

        // If this route correspond to the current request URI
        // We do a substring to remove the "**" at the end of the route URL
        if (requestUri.startsWith(serviceUrl.substring(0, serviceUrl.length() - 2))) {
            if (isAuthorizedRequest(serviceUrl, serviceName, requestUri)) {
                return false;
            }
        }
    }
    return true;
}
 
Example 10
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 11
Source Project: micro-service   Source File: FirstFilter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        //HttpServletResponse response = ctx.getResponse();
        
        log.info("第一级过滤器!");
        
        log.info("===============");

//        log.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString()));
//        System.out.println(request.getRequestURL());
        
//        Object accessToken = request.getParameter("accessToken");
//        if(accessToken == null) {
//            log.warn("access token is empty");
//            ctx.setSendZuulResponse(false);
//            ctx.setResponseStatusCode(401);
//            return null;
//        }
//        log.info("access token ok");
        return null;
    }
 
Example 12
@Test
public void run_on_valid_response() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/service1" + DEFAULT_URL);
    RequestContext context = RequestContext.getCurrentContext();
    context.setRequest(request);

    MockHttpServletResponse response = new MockHttpServletResponse();
    context.setResponseGZipped(false);
    context.setResponse(response);

    InputStream in = IOUtils.toInputStream("{\"basePath\":\"/\"}", StandardCharsets.UTF_8);
    context.setResponseDataStream(in);

    filter.run();

    assertThat(response.getCharacterEncoding()).isEqualTo("UTF-8");
    assertThat(context.getResponseBody()).isEqualTo("{\"basePath\":\"/service1\"}");
}
 
Example 13
/**
 * Filter requests on endpoints that are not in the list of authorized microservices endpoints.
 */
@Override
public boolean shouldFilter() {
    String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI();

    // If the request Uri does not start with the path of the authorized endpoints, we block the request
    for (Route route : routeLocator.getRoutes()) {
        String serviceUrl = route.getFullPath();
        String serviceName = route.getId();

        // If this route correspond to the current request URI
        // We do a substring to remove the "**" at the end of the route URL
        if (requestUri.startsWith(serviceUrl.substring(0, serviceUrl.length() - 2))) {
            if (isAuthorizedRequest(serviceUrl, serviceName, requestUri)) {
                return false;
            }
        }
    }
    return true;
}
 
Example 14
@Override
public Object run() throws ZuulException {
    RequestContext ctx = RequestContext.getCurrentContext();
    HttpServletRequest request = ctx.getRequest();
    log.info(String.format("header-token:%s,param-token:%s", request.getHeader("token"), request.getParameter("token")));
    String token_header = request.getHeader("token") == null ? "" : request.getHeader("token");
    String token_param = request.getParameter("token") == null ? "" : request.getParameter("token");
    if (token_header.equals("") && token_param.equals("")) {
        try {
            ctx.setSendZuulResponse(false);
            ctx.getResponse().getWriter().write("{\"code\": 9999,\"message\": \"token is empty.\"}");
        } catch (Exception e) {
            log.warning("system error");
        }

    } else if (!token_header.equals("")) {
        log.warning(String.format("token is %s", token_header));
    } else if (!token_param.equals("")) {
        log.warning(String.format("token is %s", token_param));
    }
    return null;
}
 
Example 15
/**
 * Filter requests on endpoints that are not in the list of authorized microservices endpoints.
 */
@Override
public boolean shouldFilter() {
    String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI();
    String contextPath = RequestContext.getCurrentContext().getRequest().getContextPath();

    // If the request Uri does not start with the path of the authorized endpoints, we block the request
    for (Route route : routeLocator.getRoutes()) {
        String serviceUrl = contextPath + route.getFullPath();
        String serviceName = route.getId();

        // If this route correspond to the current request URI
        // We do a substring to remove the "**" at the end of the route URL
        if (requestUri.startsWith(serviceUrl.substring(0, serviceUrl.length() - 2))) {
return !isAuthorizedRequest(serviceUrl, serviceName, requestUri);
        }
    }
    return true;
}
 
Example 16
@Test
public void run_on_valid_response_gzip() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/service1" + DEFAULT_URL);
    RequestContext context = RequestContext.getCurrentContext();
    context.setRequest(request);

    MockHttpServletResponse response = new MockHttpServletResponse();
    context.setResponseGZipped(true);
    context.setResponse(response);

    context.setResponseDataStream(new ByteArrayInputStream(gzipData("{\"basePath\":\"/\"}")));

    filter.run();

    assertEquals("UTF-8", response.getCharacterEncoding());

    InputStream responseDataStream = new GZIPInputStream(context.getResponseDataStream());
    String responseBody = IOUtils.toString(responseDataStream, StandardCharsets.UTF_8);
    assertEquals("{\"basePath\":\"/service1\"}", responseBody);
}
 
Example 17
Source Project: convergent-ui   Source File: BaseFilter.java    License: Apache License 2.0 6 votes vote down vote up
protected void writeResponse(String responseBody, MimeType contentType) throws Exception {
    RequestContext context = RequestContext.getCurrentContext();
    // there is no body to send
    if (responseBody == null || responseBody.isEmpty()) {
        return;
    }
    HttpServletResponse servletResponse = context.getResponse();
    servletResponse.setCharacterEncoding("UTF-8");
    servletResponse.setContentType(contentType.toString());
    OutputStream outStream = servletResponse.getOutputStream();
    InputStream is = null;
    try {
        writeResponse(new ByteArrayInputStream(responseBody.getBytes()), outStream);
    } finally {
        try {
            if (is != null) {
                is.close();
            }
            outStream.flush();
            outStream.close();
        } catch (IOException ex) {
        }
    }
}
 
Example 18
Source Project: heimdall   Source File: RequestHelper.java    License: Apache License 2.0 6 votes vote down vote up
/**
    * Tries to create a {@link RequestResponseParser} from the current context.
    * If it fail, returns a new {@link RequestResponseParser}.
    * 
    * @return {@link RequestResponseParser}
    */
   public RequestResponseParser dumpRequest() {
        RequestContext ctx = RequestContext.getCurrentContext();
        RequestResponseParser reqDTO = new RequestResponseParser();
        HttpServletRequest request = ctx.getRequest();
        
        try {
             reqDTO.setHeaders(getRequestHeadersInfo(request));
             reqDTO.setBody(StreamUtils.copyToString(request.getInputStream(), Charset.forName("UTF-8")));
             reqDTO.setUri(UrlUtil.getCurrentUrl(request));
} catch (IOException e) {
     log.error(e.getMessage(), e);
	return new RequestResponseParser(); 
}
        
        return reqDTO;
   }
 
Example 19
Source Project: pig   Source File: AccessFilter.java    License: MIT License 6 votes vote down vote up
@Override
public Object run() {
    RequestContext requestContext = RequestContext.getCurrentContext();
    String version = requestContext.getRequest().getHeader(SecurityConstants.VERSION);
    if (canary && StrUtil.isNotBlank(version)) {
        RibbonVersionHolder.setContext(version);
    }

    requestContext.set("startTime", System.currentTimeMillis());
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication != null) {
        requestContext.addZuulRequestHeader(SecurityConstants.USER_HEADER, authentication.getName());
        requestContext.addZuulRequestHeader(SecurityConstants.ROLE_HEADER, CollectionUtil.join(authentication.getAuthorities(), ","));
    }
    return null;
}
 
Example 20
Source Project: api-layer   Source File: SlashFilterTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void proxyIsNull() throws Exception {
    final RequestContext ctx = RequestContext.getCurrentContext();
    ctx.set(PROXY_KEY, null);
    this.filter.run();
    Boolean isLocation = false;
    List<Pair<String, String>> zuulResponseHeaders = ctx.getZuulResponseHeaders();
    if (zuulResponseHeaders != null) {
        for (Pair<String, String> header : zuulResponseHeaders) {
            if (header.first().equals("Location"))
                isLocation = true;
        }
    }
    assertEquals(false, isLocation);
    assertEquals(500, ctx.getResponseStatusCode());
}
 
Example 21
Source Project: api-layer   Source File: ZosmfScheme.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void applyToRequest(HttpRequest request) {
    Cookies cookies = Cookies.of(request);
    final RequestContext context = RequestContext.getCurrentContext();

    Optional<String> jwtToken = authenticationService.getJwtTokenFromRequest(context.getRequest());
    jwtToken.ifPresent(token -> {
        // parse JWT token to detect the source (z/OSMF / Zowe)
        QueryResponse queryResponse = authenticationService.parseJwtToken(token);
        switch (queryResponse.getSource()) {
            case ZOSMF:
                cookies.remove(authConfigurationProperties.getCookieProperties().getCookieName());
                createCookie(cookies, ZosmfService.TokenType.JWT.getCookieName(), token);
                break;
            case ZOWE:
                final String ltpaToken = authenticationService.getLtpaTokenWithValidation(token);
                createCookie(cookies, ZosmfService.TokenType.LTPA.getCookieName(), ltpaToken);
                break;
            default:
                return;
        }
        // remove authentication part
        request.removeHeaders(HttpHeaders.AUTHORIZATION);
    });
}
 
Example 22
Source Project: tutorials   Source File: SwaggerBasePathRewritingFilterTest.java    License: MIT License 6 votes vote down vote up
@Test
public void run_on_valid_response_gzip() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/service1" + DEFAULT_URL);
    RequestContext context = RequestContext.getCurrentContext();
    context.setRequest(request);

    MockHttpServletResponse response = new MockHttpServletResponse();
    context.setResponseGZipped(true);
    context.setResponse(response);

    context.setResponseDataStream(new ByteArrayInputStream(gzipData("{\"basePath\":\"/\"}")));

    filter.run();

    assertEquals("UTF-8", response.getCharacterEncoding());

    InputStream responseDataStream = new GZIPInputStream(context.getResponseDataStream());
    String responseBody = IOUtils.toString(responseDataStream, StandardCharsets.UTF_8);
    assertEquals("{\"basePath\":\"/service1\"}", responseBody);
}
 
Example 23
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();

    Set<String> headers = (Set<String>) ctx.get("ignoredHeaders");
    // We need our JWT tokens relayed to resource servers
    headers.remove("authorization");

    return null;
}
 
Example 24
Source Project: api-layer   Source File: RequestContextUtilsTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
void givenEmptyContext_whenInfoStored_thenStoreInfo() {
    InstanceInfo info = InstanceInfo.Builder.newBuilder().setAppName("Vanessa").build();
    assertThat(RequestContext.getCurrentContext().get(INSTANCE_INFO_KEY), is(nullValue()));
    RequestContextUtils.setInstanceInfo(info);
    assertThat(RequestContext.getCurrentContext().get(INSTANCE_INFO_KEY), is(info));
}
 
Example 25
Source Project: api-layer   Source File: SlashFilterTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void shouldNotFilterWhenItEndsWithSlash() throws Exception {
    final RequestContext ctx = RequestContext.getCurrentContext();
    MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setRequestURI("/ui/service/");
    ctx.setRequest(mockRequest);
    assertEquals(false, this.filter.shouldFilter());
}
 
Example 26
Source Project: api-layer   Source File: RequestContextUtilsTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
void givenRequestContext_whenRequestContextHasInfo_thenRetrieveIt() {
    InstanceInfo info = InstanceInfo.Builder.newBuilder().setAppName("Francesca").build();
    RequestContext.getCurrentContext().set(INSTANCE_INFO_KEY, info);
    assertThat(RequestContextUtils.getInstanceInfo().isPresent(), is(true));
    assertThat(RequestContextUtils.getInstanceInfo().get(), is(info));
}
 
Example 27
Source Project: convergent-ui   Source File: ConvergentUIRequestFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Object run() {
    //First we need to build the correct URL
    RequestContext ctx = RequestContext.getCurrentContext();
    HttpServletRequest req = ctx.getRequest();

    String path = req.getRequestURI();

    String location = path.substring("/cui-req://".length());
    log.debug("RequestFilter for [ " + location + " ] in process");

    RequestContext context = RequestContext.getCurrentContext();
    ContentResponse response = contentManager.getContentFromService(location, location, false, context);

    MimeType type = response.getContentType();
    
    addResponseHeaders();

    if (!response.isError()) {
        Object resp = response.getContent();
        try {
            
            if (String.class.isAssignableFrom(resp.getClass())) {
                writeResponse((String) resp, type);
            } else if (BufferedImage.class.isAssignableFrom(resp.getClass())) {
                writeResponse((BufferedImage) resp, response.getContentType());
            } else if (/*Map.class.isAssignableFrom(resp.getClass()) &&*/ type.getSubtype().contains("json")) {
                writeResponse(mapper.writeValueAsString(resp), type);
            } else {
                
                log.warn("Unknown response type [ " + response.getContentType() + " ] that we can't handle yet. Content is of type: " + resp.getClass());
            }
        } catch (Exception ex) {
            log.error("Error writing response", ex);
        }
    }
    return null;

}
 
Example 28
Source Project: api-layer   Source File: SlashFilter.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean shouldFilter() {
    RequestContext context = RequestContext.getCurrentContext();
    String url = context.getRequest().getRequestURL().toString().toLowerCase();
    String serviceId = (String) context.get(SERVICE_ID_KEY);
    String proxy = (String) context.get(PROXY_KEY);
    boolean checkProxy = (proxy != null) && proxy.toLowerCase().contains(UI_IDENTIFIER);
    boolean checkServiceId = (serviceId != null) && !serviceId.isEmpty() && url.endsWith(serviceId);
    return checkProxy && checkServiceId;
}
 
Example 29
Source Project: DBus   Source File: AuthenticationFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();
    HttpServletRequest request = ctx.getRequest();
    logger.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString()));

    String token = getToken(request);

    ResultEntityBuilder builder = new ResultEntityBuilder(ms);
    if (StringUtils.isNotBlank(token)) {
        try {
            Jws<Claims> jws = JWTUtils.parseToken(token, SIGNING_KEY);

            setParameter(ctx, PARAMETER_KEY_USER, jws.getBody().get("userId").toString());
            setParameter(ctx, PARAMETER_KEY_EMAIL, jws.getBody().get("email").toString());
            setParameter(ctx, PARAMETER_KEY_ROLE, jws.getBody().get("roleType").toString());

            logger.info("{}服务收到请求,URL参数:{},表单参数:{}", request.getRequestURI(), ctx.getRequestQueryParams(), getRequestBody(request));
            ctx.setSendZuulResponse(true);
            return null;
        } catch (ExpiredJwtException ee) {
            ctx.setResponseBody(builder.status(MessageCode.TOKEN_EXPIRED).build().toJSON());
        } catch (Exception e) {
            logger.error("parse token error", e);
            ctx.setResponseBody(builder.status(MessageCode.TOKEN_ILLEGAL).build().toJSON());
        }
    } else {
        ctx.setResponseBody(builder.status(MessageCode.TOKEN_NOT_FOUND).build().toJSON());
    }
    ctx.getResponse().setContentType(MediaType.APPLICATION_JSON_UTF8.toString());
    ctx.setSendZuulResponse(false);
    return null;
}
 
Example 30
@Test
public void sameServerAndUrlNotMatched() {
    String serviceUrl = "/discoverableclient/api/v1";
    RoutedService currentService = new RoutedService("api-v1", "api/v1", serviceUrl);
    RoutedServices routedServices = new RoutedServices();
    routedServices.addRoutedService(currentService);
    this.filter.addRoutedServices(SERVICE_ID, routedServices);

    when(discoveryClient.getInstances(SERVICE_ID)).thenReturn(Collections.singletonList(
        new DefaultServiceInstance(SERVICE_ID, TARGET_SERVER_HOST, TARGET_SERVER_PORT, true)
    ));

    response.setStatus(304);
    String relativePath = "/some/path/login.html";
    String location = mockLocationSameServer(relativePath);

    final RequestContext ctx = RequestContext.getCurrentContext();
    ctx.addZuulResponseHeader(LOCATION, location);
    this.filter.run();

    Optional<Pair<String, String>> locationHeader = ctx.getZuulResponseHeaders()
        .stream()
        .filter(stringPair -> LOCATION.equals(stringPair.first()))
        .findFirst();

    verifyLocationNotUpdated(locationHeader.map(Pair::second).orElse(null), location);
}