@Test
    @Configuration("{" +
            "  \"fromRegex\" : \"\\/my-api/(.*)\",\n" +
            "  \"toReplacement\" : \"/$1?foo=bar\",\n" +
            "  \"processResponseBody\" : false,\n" +
            "  \"processResponseHeaders\" : false,\n" +
            "  \"processRequestHeaders\" : true,\n" +
            "  \"processRequestUrl\" : true\n" +
            "}")
    @BackEndApi(EchoBackEndApi.class)
    public void testRewriteRequest() throws Throwable {
        final PolicyTestRequest request = PolicyTestRequest.build(PolicyTestRequestType.GET, "/my-api/api-path");
        request.header("X-Custom-Location", "/my-api/another-path");

        final PolicyTestResponse response = send(request);
        final String responseBody = response.body();
        Assert.assertNotNull(responseBody);

        final HashMap responseMap = new ObjectMapper().readValue(responseBody, HashMap.class);
        Assert.assertEquals("/api-path?foo=bar", responseMap.get("resource"));
        Assert.assertEquals("/another-path?foo=bar", ((Map) responseMap.get("headers")).get("X-Custom-Location"));
    }
Rewrite the request URL and a URL in the request header.
gateway/engine/policies/src/test/java/io/apiman/gateway/engine/policies/URLRewritingPolicyTest.java