fix bugs:add default User-Agent

java.ajax(url):it doesnot work if url has no urlOptions
pull/442/head
AndyBernie 4 years ago
parent c9ba317fa9
commit 59384e4185
  1. 6
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -189,9 +189,6 @@ class AnalyzeUrl(
?.let { headerMap.putAll(it) } ?.let { headerMap.putAll(it) }
} }
} }
headerMap[UA_NAME] ?: let {
headerMap[UA_NAME] = userAgent
}
option.charset?.let { charset = it } option.charset?.let { charset = it }
option.body?.let { option.body?.let {
body = if (it is String) it else GSON.toJson(it) 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) { when (method) {
RequestMethod.GET -> { RequestMethod.GET -> {
if (!useWebView) { if (!useWebView) {

Loading…
Cancel
Save