Retrofit Encoding Special Characters
I am using retrofit with gson instead of android since its faster and more secure. The problem is that retrofit is encoding special characters like = and ?, and the url I'm using
Solution 1:
You must use Use @EncodedPath. like this:
publicinterfaceplaceApi {
@GET("/{id}")
public void getFeed(@EncodedPath("id") TypedString id,
Callback<PlaceModel> response);
}
Note: The above works but now I am looking at the doc and it seems that the @EncodedPath is deprecated so use @PATH with its parameter instead:
publicinterfaceplaceApi {
@GET("/{id}")
public void getFeed(@Path("id", encode=false) TypedString id,
Callback<PlaceModel> response);
}
ref: https://square.github.io/retrofit/2.x/retrofit/
Post a Comment for "Retrofit Encoding Special Characters"