【发布时间】:2017-06-27 07:47:54
【问题描述】:
我想使用多个参数而不是一个 @Body 参数进行 POST 请求调用。我没有在这个上使用@FormUrlEncoded 注释,我也不想这样做。我正在使用 Retrofit 2.0。
目前,调用方式是这样的:
@POST("user/register")
Call<APIResponse> register(@Body RequestRegisterParams params);
RequestRegisterParams 为:
public class RequestRegisterParams {
public String username;
public String email;
public String password;
}
我希望能够做到这一点(当然需要适当的注释):
@POST("user/register")
Call<APIResponse> register(String username, String email, String password);
我的目标是摆脱数据模型类。有没有办法做到这一点,或者没有 @FormUrlEncoded 的 POST 请求必须只有一个 @Body 参数?我知道它只能是一个 @Body 参数,但可能还有其他注释?
提前致谢!
【问题讨论】: