This commit is contained in:
Rossen Stoyanchev
2019-07-19 09:39:42 +01:00
parent 4973e110ee
commit 153ac82380
2 changed files with 7 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -90,10 +90,10 @@ public class ForwardedHeaderTransformerTests {
assertForwardedHeadersRemoved(request);
}
@Test
public void emptyXForwardedPrefixShouldNotLeadToDecodedPath() throws Exception {
@Test // gh-23305
public void xForwardedPrefixShouldNotLeadToDecodedPath() throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.add("X-Forwarded-Prefix", "");
headers.add("X-Forwarded-Prefix", "/prefix");
ServerHttpRequest request = MockServerHttpRequest
.method(HttpMethod.GET, new URI("https://example.com/a%20b?q=a%2Bb"))
.headers(headers)
@@ -101,8 +101,8 @@ public class ForwardedHeaderTransformerTests {
request = this.requestMutator.apply(request);
assertThat(request.getURI()).isEqualTo(new URI("https://example.com/a%20b?q=a%2Bb"));
assertThat(request.getPath().value()).isEqualTo("/a%20b");
assertEquals(new URI("https://example.com/prefix/a%20b?q=a%2Bb"), request.getURI());
assertEquals("/prefix/a%20b", request.getPath().value());
assertForwardedHeadersRemoved(request);
}