为java.ajax(url)添加默认ua

pull/337/head
AndyBernie 4 years ago
parent c23173f668
commit cd4969c97d
  1. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -191,6 +191,7 @@ class AnalyzeUrl(
?.let { headerMap.putAll(it) } ?.let { headerMap.putAll(it) }
} }
} }
headerMap[UA_NAME] = headerMap[UA_NAME] ?: userAgent
charset = option.charset charset = option.charset
body = if (option.body is String) { body = if (option.body is String) {
option.body option.body
@ -352,7 +353,6 @@ class AnalyzeUrl(
if (cookie.isNotEmpty()) { if (cookie.isNotEmpty()) {
headerMap["Cookie"] += cookie headerMap["Cookie"] += cookie
} }
headerMap[UA_NAME] = headerMap[UA_NAME] ?: userAgent
return if (fieldMap.isEmpty()) { return if (fieldMap.isEmpty()) {
HttpHelper.getBytes(url, mapOf(), headerMap) HttpHelper.getBytes(url, mapOf(), headerMap)
} else { } else {

Loading…
Cancel
Save