fix: default body to empty string if not present for FlareSolverr POST requests (#1915)

* fix: convert `RequestBody` to `FormBody` in FlareSolverr `POST` requests

* linting

* ref: don't convert json to form

* remove unused import
This commit is contained in:
David Brochero
2026-02-20 22:09:34 -03:00
committed by GitHub
parent 2249d237dd
commit f977d181a8
@@ -211,10 +211,18 @@ object CFClearance {
returnOnlyCookies = onlyCookies,
maxTimeout = timeout.inWholeMilliseconds.toInt(),
postData =
if (originalRequest.method == "POST" && originalRequest.body is FormBody) {
Buffer()
.also { (originalRequest.body as FormBody).writeTo(it) }
.readUtf8()
if (originalRequest.method == "POST") {
when (val body = originalRequest.body) {
is FormBody -> {
Buffer()
.also { body.writeTo(it) }
.readUtf8()
}
else -> {
""
}
}
} else {
null
},