android - Retrofit 2 无法对正文使用 Delete 标签

标签 android networking retrofit2

我的调用实现为

 @HTTP(method = "DELETE", hasBody = true)
        @DELETE("groups/{groupId}/members/remove")
        Call<GroupRemoveUserModel> putRemoveUser(@Path("groupId") int groupId, @Body GroupRemoveUserModel groupRemoveUserModel);

其中模型代码如下:

public final class GroupRemoveUserModel {

    public GroupRemoveUserModel(int userId){
        this.userId = userId;
    }
}

但是,当我使用适当的参数调用该方法时,它不起作用而且无法获得任何堆栈跟踪以及已经使用 okhttp 记录器进行调试

最佳答案

尝试使用这个:

@HTTP(method = "DELETE", path = "groups/{groupId}/members/remove", hasBody = true)
Call<GroupRemoveUserModel> putRemoveUser(@Path("groupId") int groupId, @Body GroupRemoveUserModel groupRemoveUserModel);

关于android - Retrofit 2 无法对正文使用 Delete 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40482315/

相关文章:

Android 省电模式监听器?

具有行间距的 Android spannable 字符串

java - 如何排除异步任务故障?

android - 在Splashscreen Activity里面我实现了接口(interface)。 Kotlin中如何将接口(interface)数据发送到多个Activity?

Windows 7 : sniff TCP sockets to localhost

node.js - 为什么 Web 服务器仍然使用 http 1.1 而不是 http 2?

java - 自动定位客户的服务器

android - 翻新请求在 VPN 后面抛出 UnknownHostException

Android Retrofit-2 "Unable to Get String Array"

java - 使用 Retrofit2 获取响应主体的空数据?