From a2b309abb59674413290e6961a6ac16f785f1260 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 9 May 2021 16:02:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E9=A1=B5=E8=AE=BF=E9=97=AE404?= =?UTF-8?q?=E4=BE=9D=E7=84=B6=E8=BF=94=E5=9B=9Ebody?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/http/OkHttpUtils.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/http/OkHttpUtils.kt b/app/src/main/java/io/legado/app/help/http/OkHttpUtils.kt index f87d58aab..bb50bf60a 100644 --- a/app/src/main/java/io/legado/app/help/http/OkHttpUtils.kt +++ b/app/src/main/java/io/legado/app/help/http/OkHttpUtils.kt @@ -28,7 +28,7 @@ suspend fun OkHttpClient.newCall( return response.body!! } } - throw IOException(response!!.message) + return response!!.body ?: throw IOException(response.message) } suspend fun OkHttpClient.newCallStrResponse( @@ -45,7 +45,7 @@ suspend fun OkHttpClient.newCallStrResponse( return StrResponse(response, response.body!!.text()) } } - throw IOException(response!!.message) + return StrResponse(response!!, response.body?.text() ?: response.message) } suspend fun Call.await(): Response = suspendCancellableCoroutine { block ->