Search code examples
androidretrofitrx-java

Does RxJava Completable only triggers onComplete if the response is 2xx?


I'm using Retrofit with RxJava in Android and making a POST request that returns a Completable.

If it can reach the server and the POST is successful it returns 2xx and it triggers onComplete.

If for example i have no internet it triggers onError.

What happens if it reaches the server and the POST returns a non 2xx code? Does it trigger onComplete too or onError?

If it triggers onComplete, how can i check if it the POST was successful?

Thanks in advance.


Solution

  • All non-2xx codes will trigger onError()