How to send a HTTP-delete with a body in retrofit?

后端 未结 6 1215
暖寄归人
暖寄归人 2020-12-14 01:44

When I try to create a delete method:

public interface ImageService {
    @DELETE(\"api/v1/attachment\")
    Call delete(@Body DeleteMode         


        
6条回答
  •  有刺的猬
    2020-12-14 01:52

    Here's an excerpt from the docs, it's a documented feature of the HTTP annotation.

    This annotation can also used for sending DELETE with a request body:
    
     interface Service {
       @HTTP(method = "DELETE", path = "remove/", hasBody = true)
       Call deleteObject(@Body RequestBody object);
     }
    

    https://square.github.io/retrofit/2.x/retrofit/retrofit2/http/HTTP.html

提交回复
热议问题