Skip to content

Encoding of URI Variables on RestTemplate [SPR-16202] #20750

Closed
@spring-projects-issues

Description

@spring-projects-issues

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&param2=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:

0 votes, 7 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions