Retrofit post request with parameters

后端 未结 3 1883
北海茫月
北海茫月 2021-01-23 02:50

I am using postman extension for post request. I want to make same request with android. I used retrofit library for access my goal. But I can\'t get successful result. Where is

3条回答
  •  无人共我
    2021-01-23 03:16

    Try this provide body

    public class SignBody {
      @SerializedName("signin[username]") @Expose private String username;
      @SerializedName("signin[password]") @Expose private String password;
    }
    

    change interface to

    @POST("/login")
        Call getResponse(@Body SignBody body);
    

提交回复
热议问题