Retrofit实现Delete请求


    //设置取消关注
    @Headers("Content-Type:application/x-www-form-urlencoded")
    @HTTP(method = "DELETE", path = Constant.NEWATTENTION, hasBody = true)
    @FormUrlEncoded
    Call<ResultInfo> setNotAttention(@Field("user_id") String user_id, @Field("token") String token, @Field("attu_id") String attu_id, @Field("type") String type);

1、首先要设置请求头 application/x-www-form-urlencoded

2、设置请求的方法 因为默认delete请求是不能带body的 所以需要单独设置为true


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM