From 8b9d2e5d5cde6d948ee3128f03561b1d6d9cb585 Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Mon, 27 May 2024 22:46:38 +0200 Subject: [PATCH] fix(scripting/networking): method --- .../snapenhance/common/scripting/impl/Networking.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/scripting/impl/Networking.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/scripting/impl/Networking.kt index 72caa150..8a497bf8 100644 --- a/common/src/main/kotlin/me/rhunk/snapenhance/common/scripting/impl/Networking.kt +++ b/common/src/main/kotlin/me/rhunk/snapenhance/common/scripting/impl/Networking.kt @@ -33,13 +33,16 @@ class Networking : AbstractBinding("networking", BindingSide.COMMON) { fun removeHeader(name: String) = requestBuilder.removeHeader(name).let { this } @JSFunction - fun method(method: String, body: String) = requestBuilder.method(method, body.toRequestBody(null)).let { this } + fun method(method: String) = requestBuilder.method(method.uppercase(), null).let { this } @JSFunction - fun method(method: String, body: java.io.InputStream) = requestBuilder.method(method, body.readBytes().toRequestBody(null)).let { this } + fun method(method: String, body: String) = requestBuilder.method(method.uppercase(), body.toRequestBody(null)).let { this } @JSFunction - fun method(method: String, body: ByteArray) = requestBuilder.method(method, body.toRequestBody(null)).let { this } + fun method(method: String, body: java.io.InputStream) = requestBuilder.method(method.uppercase(), body.readBytes().toRequestBody(null)).let { this } + + @JSFunction + fun method(method: String, body: ByteArray) = requestBuilder.method(method.uppercase(), body.toRequestBody(null)).let { this } } inner class ResponseWrapper(