HttpException
.A call adapter which creates Java 8 futures.
Adding this class to Retrofit
allows you to return CompletableFuture
from
service methods.
interface MyService {
@GET("user/me")
CompletableFuture<User> getUser()
}
There are two configurations supported for the CompletableFuture
type parameter:
CompletableFuture<User>
) returns the deserialized body for
2XX responses, sets HttpException
errors for non-2XX
responses, and sets IOException
for network errors.
CompletableFuture<Response<User>>
) returns a
Response
object for all HTTP responses and sets IOException
for network
errors