Support encoded query string in reactive requests

In addition to the updates from PR#1297 this commit adds an integration
test and fixes for the resulting failures with RxNetty, Reactor Netty,
and Undertow.

Also replaced use of URLDecoder which is not for decoding URIs with use
of UriUtils for decoding query parameters.

Issue: SPR-15140
This commit is contained in:
Rossen Stoyanchev
2017-01-17 12:41:54 -05:00
parent 613e65f043
commit 9819558cba
7 changed files with 49 additions and 57 deletions

View File

@@ -36,9 +36,9 @@ public class ServerHttpRequestIntegrationTests extends AbstractHttpHandlerIntegr
@Test
public void checkUri() throws Exception {
RestTemplate restTemplate = new RestTemplate();
RequestEntity<Void> request = RequestEntity.post(new URI("http://localhost:" + port + "/foo?param=bar")).build();
ResponseEntity<Void> response = restTemplate.exchange(request, Void.class);
URI url = new URI("http://localhost:" + port + "/foo?param=bar");
RequestEntity<Void> request = RequestEntity.post(url).build();
ResponseEntity<Void> response = new RestTemplate().exchange(request, Void.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
}

View File

@@ -64,11 +64,11 @@ public class ServerHttpRequestTests {
assertEquals(Arrays.asList("1", "2"), params.get("a"));
}
@Test
public void queryParamsWithUrlEncodedValue() throws Exception {
@Test // SPR-15140
public void queryParamsWithEncodedValue() 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"));
assertEquals(Collections.singletonList(" ++\u00e0"), params.get("a"));
}
@Test