From 01aeb8d698cf04d8288a04effbd3f6494816e17e Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Wed, 10 Apr 2024 17:17:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E5=BA=94=E7=AD=94`HTTP=20Status=20201-299`=E6=97=B6?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86=EF=BC=88=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=8A=B6=E6=80=81=E4=B8=BA=E6=88=90=E5=8A=9F?= =?UTF-8?q?=EF=BC=89=20#234?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/forwarder/utils/interceptor/NoContentInterceptor.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/idormy/sms/forwarder/utils/interceptor/NoContentInterceptor.kt b/app/src/main/java/com/idormy/sms/forwarder/utils/interceptor/NoContentInterceptor.kt index 54577276..fa39a0b4 100644 --- a/app/src/main/java/com/idormy/sms/forwarder/utils/interceptor/NoContentInterceptor.kt +++ b/app/src/main/java/com/idormy/sms/forwarder/utils/interceptor/NoContentInterceptor.kt @@ -13,6 +13,7 @@ import okhttp3.Interceptor import okhttp3.Response import java.util.concurrent.TimeUnit +@Suppress("PrivatePropertyName") class NoContentInterceptor(private val logId: Long) : Interceptor { private val TAG: String = NoContentInterceptor::class.java.simpleName @@ -20,8 +21,9 @@ class NoContentInterceptor(private val logId: Long) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val originalResponse = chain.proceed(chain.request()) - if (originalResponse.code() == 204) { - val response = "HTTP 204 No Content" + //HTTP Status 201-299 都算成功 + if (originalResponse.code() in 201..299) { + val response = "HTTP Status " + originalResponse.code() + " " + originalResponse.message() Log.d(TAG, response) /* // 创建一个空的响应体