pull/32/head
kunfei 5 years ago
parent e0453a5547
commit dd4fa27856
  1. 4
      app/src/main/java/io/legado/app/data/api/IHttpGetApi.kt
  2. 4
      app/src/main/java/io/legado/app/data/api/IHttpPostApi.kt
  3. 2
      app/src/main/java/io/legado/app/help/JsExtensions.kt
  4. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -31,12 +31,12 @@ interface IHttpGetApi {
fun get(
@Url url: String,
@HeaderMap headers: Map<String, String>
): Call<Response<String>>
): Call<String>
@GET
fun getMap(
@Url url: String,
@QueryMap(encoded = true) queryMap: Map<String, String>,
@HeaderMap headers: Map<String, String>
): Call<Response<String>>
): Call<String>
}

@ -34,12 +34,12 @@ interface IHttpPostApi {
@Url url: String,
@FieldMap(encoded = true) fieldMap: Map<String, String>,
@HeaderMap headers: Map<String, String>
): Call<Response<String>>
): Call<String>
@POST
fun postBody(
@Url url: String,
@Body body: RequestBody,
@HeaderMap headers: Map<String, String>
): Call<Response<String>>
): Call<String>
}

@ -17,7 +17,7 @@ class JsExtensions {
val analyzeUrl = AnalyzeUrl(urlStr, null, null, null, null, null)
val call = analyzeUrl.getResponse()
val response = call.execute()
response.body()?.toString()
response.body()
} catch (e: Exception) {
e.localizedMessage
}

@ -200,7 +200,7 @@ class AnalyzeUrl(
GET, POST
}
fun getResponse(): Call<Response<String>> {
fun getResponse(): Call<String> {
return when {
method == Method.POST -> {
if (fieldMap.isNotEmpty()) {

Loading…
Cancel
Save