Closed
Description
Nicolas Miranda opened SPR-16202 and commented
On Version 5.0.1 encoding works different than version 4.x.
Given the following code in version 5 the parameter is received by any endpoint with an space "a b" while in version 4 it was received with "a+b". I tried to encode the + sign with %2B but is received as %2B. I don't know if its a bug on version 4 or version 5 but it works different.
// Some comments here
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/test?param1=a+b¶m2=d";
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> req = new HttpEntity<String>(new String(""), headers);
String restResp = restTemplate.postForObject(url, req, String.class);
System.out.println(restResp);
Affects: 5.0.1
Issue Links:
- Not encoding '+' in URLs anymore breaks backwards compatibility with apps running on spring 4 [SPR-17474] #22006 Not encoding '+' in URLs anymore breaks backwards compatibility with apps running on spring 4 ("is duplicated by")
- UriComponentBuilder doesn't work with encoded HTTP URL having '+'. [SPR-14828] #19394 UriComponentBuilder doesn't work with encoded HTTP URL having '+'.
- [docs] Explain URI template encoding [SPR-16422] #20968 [docs] Explain URI template encoding
- Support stricter encoding of URI variables in UriComponents [SPR-17039] #21577 Support stricter encoding of URI variables in UriComponents ("is superseded by")
0 votes, 7 watchers