pull/416/head
gedoor 4 years ago
parent e64a8aa16e
commit bed1791dbf
  1. 16
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -191,7 +191,9 @@ class AnalyzeUrl(
if (urlArray.size > 1) { if (urlArray.size > 1) {
val option = GSON.fromJsonObject<UrlOption>(urlArray[1]) val option = GSON.fromJsonObject<UrlOption>(urlArray[1])
option?.let { _ -> option?.let { _ ->
option.method?.let { if (it.equals("POST", true)) method = RequestMethod.POST } option.method?.let {
if (it.equals("POST", true)) method = RequestMethod.POST
}
option.type?.let { type = it } option.type?.let { type = it }
option.headers?.let { headers -> option.headers?.let { headers ->
if (headers is Map<*, *>) { if (headers is Map<*, *>) {
@ -202,13 +204,13 @@ class AnalyzeUrl(
GSON.fromJsonObject<Map<String, String>>(headers) GSON.fromJsonObject<Map<String, String>>(headers)
?.let { headerMap.putAll(it) } ?.let { headerMap.putAll(it) }
} }
headerMap[UA_NAME] ?: let {
headerMap[UA_NAME] = userAgent
} }
headerMap[UA_NAME] = headerMap[UA_NAME] ?: userAgent }
charset = option.charset option.charset?.let { charset = it }
body = if (option.body is String) { option.body?.let {
option.body body = if (it is String) it else GSON.toJson(it)
} else {
GSON.toJson(option.body)
} }
option.webView?.let { option.webView?.let {
if (it.toString().isNotEmpty()) { if (it.toString().isNotEmpty()) {

Loading…
Cancel
Save