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