Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'+'(Plus sign) interpreted as a ' ' (space) when using RestTemplate #22488

Closed
morDevelop opened this issue Feb 27, 2019 · 1 comment
Closed
Labels
for: stackoverflow A question that's better suited to stackoverflow.com status: invalid An issue that we don't feel is valid

Comments

@morDevelop
Copy link

morDevelop commented Feb 27, 2019

Hi,
I'm using Spring version: 5.0.6.RELEASE.
I have exactly the same issue as described here: Stackoverflow#54294843

I'm sending the following GET request using the RestTemplate:
GET http://localhost:9092/sites/?email=test+f@gmail.com
When I'm using RestTemplate in attempt to send the request above,
test+f@gmail.com is being interpreted astest f@gmail.com ('+' interpreted as ' ')

I'm looking for a solution that doesn't involve workarounds.

Bests.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 27, 2019
@bclozel
Copy link
Member

bclozel commented Mar 4, 2019

Hello @morDevelop

See this part of the reference documentation for the full picture.

See this particular issue for a similar case and this other issue which improves things.

In your particular case, you could go:

URI uri = UriComponentBuilder.fromHttpUrl("http://localhost:9092/sites/")
    .queryParam("email", "{email}").encode().buildAndExpand("test+f@gmail.com"); 

Feel free to submit a better answer to this question on StackOverflow.

Thanks!

@bclozel bclozel closed this as completed Mar 4, 2019
@bclozel bclozel added status: invalid An issue that we don't feel is valid for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants