Fix URL decoding issue in reactive @RequestParam

%-encoded strings were injected undecoded into @RequestParam variables,
which does not coincide with spring-webmvc behaviour. This commit
fixes AbstractServerHttpRequest.getQueryParams() to correctly return
decoded name-value pairs.

Issue: SPR-15140
This commit is contained in:
Eiichi Sato
2017-01-14 20:43:31 +09:00
committed by Rossen Stoyanchev
parent 88c5f5981f
commit 613e65f043
2 changed files with 28 additions and 1 deletions

View File

@@ -64,6 +64,13 @@ public class ServerHttpRequestTests {
assertEquals(Arrays.asList("1", "2"), params.get("a"));
}
@Test
public void queryParamsWithUrlEncodedValue() throws Exception {
MultiValueMap<String, String> params = createHttpRequest("/path?a=%20%2B+%C3%A0").getQueryParams();
assertEquals(1, params.size());
assertEquals(Collections.singletonList(" + \u00e0"), params.get("a"));
}
@Test
public void queryParamsWithEmptyValue() throws Exception {
MultiValueMap<String, String> params = createHttpRequest("/path?a=").getQueryParams();