mirror of https://github.com/readrops/Readrops.git
Prevent HttpException being thrown when response code is 304
Todo: cover all non HTTP 200 cases where there is no need to throw an exception
This commit is contained in:
parent
4467774070
commit
6bf7cb00a8
|
@ -4,13 +4,14 @@ import com.readrops.api.utils.exceptions.HttpException
|
|||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
|
||||
class ErrorInterceptor() : Interceptor {
|
||||
class ErrorInterceptor : Interceptor {
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request = chain.request()
|
||||
val response = chain.proceed(request)
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
// TODO cover all cases
|
||||
if (!response.isSuccessful && response.code != 304) {
|
||||
throw HttpException(response)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue