this is my retrofit interface
@GET
void getName(@Query("name") String name, Callback callback);
http request for above format is
/getName?name=abcd
but in my case url format should go like this
/getName?name=["abcd"]
what i want to change in my interface or any gson convertor required to append [""]
to string. please give with example
I don't know about any simple way to do it using Retrofit APIs, but I would just create a method to do it and I would call it on every String I would pass to the adapter public static String enclose(String text) { return "[\\""+text+"\\"]"; }
public static String enclose(String text) { return "[\\""+text+"\\"]"; }
And call it this way
getName(enclose("abcd"), new Callback<String>() {
@Override
public void success(String s, Response response) {
}
@Override
public void failure(RetrofitError error) {
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.