diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 589b511d8..5d4890829 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/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) }