Reputation: 6996
I'm using Retrofit and RxJava. I know that i can handle the errors this way, so i can do things with the corresponding errors.
Now, I have an api call, and i need to get the request code in a 201 Http response code
and do something if 201
occurs and do something else if the response code is 200
. What is the best practice to do that?
Upvotes: 4
Views: 1109
Reputation: 1622
In that case you can use method that returns Observable<Response>
and Response
has a method getStatus() for obtaining response code.
It means you won't get deserialized response and you'd need do perform manual conversion from JSON with GsonConverter.toBody() method.
Upvotes: 4