post可以正确识别contentType

pull/1486/head
gedoor 3 years ago
parent 16007e0899
commit 874dc44dc1
  1. 10
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt

@ -435,8 +435,13 @@ class AnalyzeUrl(
when (method) {
RequestMethod.POST -> {
url(urlNoQuery)
val contentType = headerMap["Content-Type"]
val body = body
if (fieldMap.isNotEmpty() || body.isNullOrBlank()) {
postForm(fieldMap, true)
} else if (!contentType.isNullOrBlank()) {
val requestBody = body.toRequestBody(contentType.toMediaType())
post(requestBody)
} else {
postJson(body)
}
@ -466,8 +471,13 @@ class AnalyzeUrl(
when (method) {
RequestMethod.POST -> {
url(urlNoQuery)
val contentType = headerMap["Content-Type"]
val body = body
if (fieldMap.isNotEmpty() || body.isNullOrBlank()) {
postForm(fieldMap, true)
} else if (!contentType.isNullOrBlank()) {
val requestBody = body.toRequestBody(contentType.toMediaType())
post(requestBody)
} else {
postJson(body)
}

Loading…
Cancel
Save