From 6bf7cb00a880149b0e3e9fbca796eac8d17764fa Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Wed, 28 Feb 2024 22:54:07 +0100 Subject: [PATCH] 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 --- api/src/main/java/com/readrops/api/utils/ErrorInterceptor.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/readrops/api/utils/ErrorInterceptor.kt b/api/src/main/java/com/readrops/api/utils/ErrorInterceptor.kt index a0b8bb94..f462e4a7 100644 --- a/api/src/main/java/com/readrops/api/utils/ErrorInterceptor.kt +++ b/api/src/main/java/com/readrops/api/utils/ErrorInterceptor.kt @@ -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) }