Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@DELETE method is not supporting(Non-body HTTP method cannot contain @Body or @TypedOutput.)

@DELETE("/job/deletejob")
 Observable<JobDeleteResponseModel> jobDelete( @Body JobDeleteRequestModel model);

am getting this error:

Non-body HTTP method cannot contain @Body or @TypedOutput

like image 718
sandy Avatar asked Jun 21 '16 10:06

sandy


4 Answers

I've used this official workaround recently:

@HTTP(method = "DELETE", path = "/job/deletejob", hasBody = true)
Observable<JobDeleteResponseModel> jobDelete(@Body JobDeleteRequestModel model);
like image 128
AndroidEx Avatar answered Oct 15 '22 10:10

AndroidEx


try this it's work

@HTTP(method = "DELETE", path = "api/v3/delete", hasBody = true)
Call<ResponseBody> RESPONSE_BODY_CALL(@Header("Authorization") String authorization, @Body HashMap<String, List> stringListHashMap);

or check https://github.com/square/retrofit/issues/974

like image 37
Shiv Kumar Avatar answered Oct 15 '22 11:10

Shiv Kumar


You need to specify parameters
method, path, hasBody

Kotlin way

@HTTP(method = "DELETE", path = "event/eventRemovePicture", hasBody = true)
fun callDeleteImage(
    @Body body: RequestBody
): Call<RemoveEventPictureResponse>
like image 15
Aditya Patil Avatar answered Oct 15 '22 11:10

Aditya Patil


I had similar error.

In my case I was using @GET in Interface but then I corrected it to @POST method and it worked.

like image 11
Makarand Avatar answered Oct 15 '22 12:10

Makarand