Reputation: 1679
I am trying to create an api call that doesn't have a response with retrofit, but the call does not return any thing, so how do i handle it in Retrofit
i have a code like this :
@POST("/message")
public Call<ResponseModel> SendMessageToSocketIOServer(@Body SocketIOMessageModel socketIOMessageModel);
but i tried this using void but with no result
@POST("/message")
public Call<void> SendMessageToSocketIOServer(@Body SocketIOMessageModel socketIOMessageModel);
So how can i achieve handling a no response call api ?
Upvotes: 2
Views: 927
Reputation: 194
You can use Call<ResponseBody>
.Which indicates that you doesn't care about response body. But you can check the response is successful.
Upvotes: 1
Reputation: 4365
Just change Call<void>
to Call<Void>
(with uppercase V). All generic expect reference type, not primitive type or void.
Upvotes: 1