feat: 优化代码

pull/95/head
kunfei 5 years ago
parent b68063616f
commit 27bf4f3234
  1. 16
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -248,19 +248,19 @@ class AnalyzeUrl(
method == RequestMethod.POST -> {
if (fieldMap.isNotEmpty()) {
HttpHelper
.getApiService<HttpPostApi>(baseUrl)
.getApiService<HttpPostApi>(baseUrl, charset)
.postMap(url, fieldMap, headerMap)
} else {
HttpHelper
.getApiService<HttpPostApi>(baseUrl)
.getApiService<HttpPostApi>(baseUrl, charset)
.postBody(url, body!!, headerMap)
}
}
fieldMap.isEmpty() -> HttpHelper
.getApiService<HttpGetApi>(baseUrl)
.getApiService<HttpGetApi>(baseUrl, charset)
.get(url, headerMap)
else -> HttpHelper
.getApiService<HttpGetApi>(baseUrl)
.getApiService<HttpGetApi>(baseUrl, charset)
.getMap(url, fieldMap, headerMap)
}
}
@ -284,22 +284,22 @@ class AnalyzeUrl(
method == RequestMethod.POST -> {
if (fieldMap.isNotEmpty()) {
HttpHelper
.getApiService<HttpPostApi>(baseUrl)
.getApiService<HttpPostApi>(baseUrl, charset)
.postMapAsync(url, fieldMap, headerMap)
.await()
} else {
HttpHelper
.getApiService<HttpPostApi>(baseUrl)
.getApiService<HttpPostApi>(baseUrl, charset)
.postBodyAsync(url, body!!, headerMap)
.await()
}
}
fieldMap.isEmpty() -> HttpHelper
.getApiService<HttpGetApi>(baseUrl)
.getApiService<HttpGetApi>(baseUrl, charset)
.getAsync(url, headerMap)
.await()
else -> HttpHelper
.getApiService<HttpGetApi>(baseUrl)
.getApiService<HttpGetApi>(baseUrl, charset)
.getMapAsync(url, fieldMap, headerMap)
.await()
}

Loading…
Cancel
Save