当我尝试创建删除方法时:
public interface ImageService {
@DELETE("api/v1/attachment")
Call<BaseResponse> delete(@Body DeleteModel deleteModel);
}
我从堆栈跟踪中得到基本上归结为这些行的错误:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Failure delivering result
java.lang.IllegalArgumentException: Non-body HTTP method cannot contain @Body.
Caused by: java.lang.IllegalArgumentException: Non-body HTTP method cannot contain @Body.
如何将正文添加到删除方法?
我在这里搜索但发现 3 个不是答案,也没有使用改造。
原文由 HopefullyHelpful 发布,翻译遵循 CC BY-SA 4.0 许可协议
一个更简化的答案。
这样就可以了。