Add test to ensure ForwardedHeaderFilter contextPath preserves encoding

Add a test to verify that the ForwardedHeaderFilter contextPath override preserves URL encoding
as it should.

Issue SPR-15422
This commit is contained in:
Rob Winch 2017-04-10 08:54:43 -05:00
parent 46cf4f9ba1
commit 0a9f98f0df
1 changed files with 11 additions and 0 deletions

View File

@ -249,6 +249,17 @@ public class ForwardedHeaderFilterTests {
assertEquals("/prefix", actual);
}
@Test
public void contextPathPreserveEncoding() throws Exception {
this.request.setContextPath("/app%20");
this.request.setRequestURI("/app%20/path/");
HttpServletRequest actual = filterAndGetWrappedRequest();
assertEquals("/app%20", actual.getContextPath());
assertEquals("/app%20/path/", actual.getRequestURI());
assertEquals("http://localhost/app%20/path/", actual.getRequestURL().toString());
}
@Test
public void sendRedirectWithAbsolutePath() throws Exception {
this.request.addHeader(X_FORWARDED_PROTO, "https");