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

原文地址:https://www.cnblogs.com/yegong0214/p/7735257.html