commit 8b9d2e5d5cde6d948ee3128f03561b1d6d9cb585
parent 80fcdc27792df8e8fffe509fc912e6f5a24eae26
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Mon, 27 May 2024 22:46:38 +0200
fix(scripting/networking): method
Diffstat:
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
@@ -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(