From 3e42e2c133ce42c5af071ad930d0a51201928b6f Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 12 Dec 2020 09:40:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/help/http/parser/StrResponseParser.kt | 3 ++- .../main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 1 + .../java/io/legado/app/ui/book/explore/ExploreShowViewModel.kt | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/help/http/parser/StrResponseParser.kt b/app/src/main/java/io/legado/app/help/http/parser/StrResponseParser.kt index 17fb1b181..53ead9d26 100644 --- a/app/src/main/java/io/legado/app/help/http/parser/StrResponseParser.kt +++ b/app/src/main/java/io/legado/app/help/http/parser/StrResponseParser.kt @@ -12,7 +12,8 @@ import java.nio.charset.Charset class StrResponseParser(val encode: String? = null) : rxhttp.wrapper.parse.Parser { override fun onParse(response: Response): StrResponse { - return StrResponse.success(getString(response), response) + val body = getString(response) + return StrResponse.success(body, response) } private fun getString(response: Response): String { diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 6f962b421..e36750a1f 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -312,6 +312,7 @@ class AnalyzeUrl( else -> RxHttp.get(url) .setOkClient(HttpHelper.getProxyClient(proxy)) .addAll(fieldMap) + .addAllHeader(headerMap) .toStrResponse().await() } } diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowViewModel.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowViewModel.kt index f4e3e40be..089d0d2fb 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowViewModel.kt @@ -41,6 +41,7 @@ class ExploreShowViewModel(application: Application) : BaseViewModel(application App.db.searchBookDao.insert(*searchBooks.toTypedArray()) page++ }.onError { + it.printStackTrace() toast(it.msg) } }