You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending request to url that contains characters that need to be encoded TestRestTemplate does the encoding twice.
For example when sending GET to http://localhost?param={something}
the correct url string should be http://localhost?param=%7Bsomething%7D
but is http://localhost?param=%257Bsomething%257D
This bug is introduced by #7891. (Also it works OK in 1.4.3 and is broken in 1.4.4 and 1.5.1)
Method createRequestEntityWithExpandedUri first transforms the url to string and then parses it again.
This code mimics what TestRestTemplate does and you can check the difference between expected and actual result:
I'm not sure whether I should create a new issue, but I want to point out that all exchange methods that accept String instead of Uri are still affected by this bug.
@Selindek This bug was specifically for methods that took a URI so if you have a problem with methods that take a String then you are experiencing a different problem. Perhaps you're passing in a string that has already been encoded? If that's not the case and you believe that an unencoded string is being double-encoded, please open a new issue with a sample that reproduces the problem.
I think this is the similar issue because it happens if I pass a relative url in the string. (like /test?param="qqq"). And when I checked the fix it turned out that it basically fixes the relative URIs by adding the root to them. So I thought that maybe the same conversion is needed for the url-Strings too...
When sending request to url that contains characters that need to be encoded TestRestTemplate does the encoding twice.
For example when sending GET to
http://localhost?param={something}
the correct url string should be
http://localhost?param=%7Bsomething%7D
but is
http://localhost?param=%257Bsomething%257D
This is my typical usage in tests (groovy):
This bug is introduced by #7891. (Also it works OK in 1.4.3 and is broken in 1.4.4 and 1.5.1)
Method
createRequestEntityWithExpandedUri
first transforms the url to string and then parses it again.This code mimics what TestRestTemplate does and you can check the difference between expected and actual result:
The text was updated successfully, but these errors were encountered: