MockHttpServletRequestBuilder decodes pathInfo

Previously MockHttpServletRequestBuilder calculated the pathInfo from the
provided URL without decoding the value. This meant that the pathInfo
incorrectly included URL encoded values.

Now MockHttpServletRequestBuilder properly decodes the pathInfo.

Fixes: SPR-16453
This commit is contained in:
Rob Winch
2018-02-01 13:23:43 -06:00
committed by Rossen Stoyanchev
parent 609f173ebc
commit 0cd427bdd3
2 changed files with 12 additions and 1 deletions

View File

@@ -164,6 +164,14 @@ public class MockHttpServletRequestBuilderTests {
assertNull(request.getPathInfo());
}
@Test
public void pathInfoIsDecoded() {
this.builder = new MockHttpServletRequestBuilder(HttpMethod.GET, "/travel/hotels 42");
MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);
assertEquals("/travel/hotels 42", request.getPathInfo());
}
@Test
public void contextPathServletPathInvalid() {
testContextPathServletPathInvalid("/Foo", "", "Request URI [/foo/bar] does not start with context path [/Foo]");