Retrofit, callback for 204 No Content response?
This is the kotlin way for the implementation to deal with HTTP 204 and no content.
@DELETE(USER_API_BASE_URL + "/{id}")
suspend fun deleteuser(@HeaderMap headers: Map<String, String>,
@Path("id") id: String)
: Response<Void>
The solution was pointed out by Jake Wharton in the comments. Use ResponseCallback.
EDIT: this response is no longer valid for Retrofit < 2.
Retrofit 2.x
no longer has a ResponseCallback
as mentioned in the other answer. You want to use a Response<Void>
type.
The RxJava declaration:
@PUT Observable<Response<Void>> foo();
The standard declaration:
@PUT Call<Response<Void>> bar();