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:
committed by
Rossen Stoyanchev
parent
609f173ebc
commit
0cd427bdd3
@@ -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]");
|
||||
|
||||
Reference in New Issue
Block a user