Invalid URI if curly brackets are used
I have the following method in my interface:
@GET("/1/classes/Tuet")
public Call<QueryResults<Tuet>> getTuetsWhere(@Query("where") String tuet);
I need the final URL to be something like: https://someurl.com/1/classes/Tuet?where={"owner":"someName"}
When I call the method getTuetsWhere() I do it with the following string: {"owner":"someName"}
In HttpUrl.java line 334 you instantiate a URI object, so before that some characters need to be replaced. The following characters are correctly replaced: double quotes --> %22 space --> %20 percentage --> %25
But the curly brackets are not replaced so an exception is thrown while trying to instantiate the URI.
11-02 02:57:16.560 23041-23062/com.someplace.workshop.tuetz E/AndroidRuntime﹕ FATAL EXCEPTION: OkHttp Dispatcher
Process: com.someplace.workshop.tuetz, PID: 23041
java.lang.IllegalStateException: not valid as a java.net.URI: https://someurl.com/1/classes/Tuet?where={%22owner%22:%22pepo%22}
at com.squareup.okhttp.HttpUrl.uri(HttpUrl.java:336)
at com.squareup.okhttp.internal.http.RouteSelector.resetNextProxy(RouteSelector.java:135)
at com.squareup.okhttp.internal.http.RouteSelector.<init>(RouteSelector.java:71)
at com.squareup.okhttp.internal.http.RouteSelector.get(RouteSelector.java:76)
at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:321)
at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:245)
Opening curly brackets should be replaced with %7B and closing curly brackets with %7D and I really don't know how to do this replacement myself because if I try to do so, the percentage symbol is converted into "%25" and so the following conversions are done instead: { --> %257B } --> %257D
Please help me
This was fixed by #1959. Please try 2.6.0-SNAPSHOT.