I'm calling an endpoint to GET a list of objects from the server. Using Retrofit2.0 + RxJava for the api calls.
The server has made it in such a way that when there are no items in the list, instead of returning an empty list, it returns null with the response code 204...
If I use an Observable<List<Item>>
when the list is empty it will hit onError because of the null body
If I use Completable
or Observable<Void>
I won't be able to handle any data returned....
I thought about handling this by verifying the error message and assuming that if is an null exception to continue with the normal flow but I'm not fully comfortable with this hack....
Is there a way to handle this situation?