当URL有"?"时,改进POST请求会转换为GET请求。内

时间:2018-03-24 20:11:36

标签: android post opencart retrofit

当URL类似于

时,Retrofit会在GET请求中转换POST

https://www.example.com/index.php?route=api/account/login

1 个答案:

答案 0 :(得分:1)

Found the solution
@FormUrlEncoded
@POST("index.php")
Call<String> login(@QueryMap(encoded=true) Map<String, String> options,@Field("email") String username,@Field("password") String password);

and calling will be like this
Map<String, String> map = new HashMap<>();
map.put("route","restapi/account/login");
Call<String> call = mAPIService.login(map, email, password);