From 59384e4185be82bb97a86efe4549828b9b218b4d Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Sat, 24 Oct 2020 21:16:39 +0800 Subject: [PATCH] fix bugs:add default User-Agent java.ajax(url):it doesnot work if url has no urlOptions --- .../main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 a7eb08968..fc752c02f 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 @@ -189,9 +189,6 @@ class AnalyzeUrl( ?.let { headerMap.putAll(it) } } } - headerMap[UA_NAME] ?: let { - headerMap[UA_NAME] = userAgent - } option.charset?.let { charset = it } option.body?.let { body = if (it is String) it else GSON.toJson(it) @@ -206,6 +203,9 @@ class AnalyzeUrl( } } } + headerMap[UA_NAME] ?: let { + headerMap[UA_NAME] = userAgent + } when (method) { RequestMethod.GET -> { if (!useWebView) {