From f977d181a875e2f1a57f0b3b267fbb269ee5e932 Mon Sep 17 00:00:00 2001 From: David Brochero <65723952+D-Brox@users.noreply.github.com> Date: Fri, 20 Feb 2026 22:09:34 -0300 Subject: [PATCH] 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 --- .../network/interceptor/CloudflareInterceptor.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt index ed26eba6..cae62706 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt @@ -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 },