From 47b0f6d2d8b54e2249ebe8c5bbe04d71a4fed22c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 1 Feb 2023 13:03:51 +0600 Subject: [PATCH] fixes --- .../dev/inmo/micro_utils/ktor/client/ActualUniUpload.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualUniUpload.kt b/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualUniUpload.kt index 572785ca371..8031c347565 100644 --- a/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualUniUpload.kt +++ b/ktor/client/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/client/ActualUniUpload.kt @@ -17,8 +17,11 @@ import io.ktor.http.HttpStatusCode import io.ktor.http.Parameters import io.ktor.http.content.PartData import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.InternalSerializationApi +import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.StringFormat import kotlinx.serialization.encodeToString +import kotlinx.serialization.serializer import java.io.File /** @@ -29,6 +32,7 @@ import java.io.File * in case you wish to pass other source of multipart binary data than regular file * @suppress */ +@OptIn(InternalSerializationApi::class) actual suspend fun HttpClient.uniUpload( url: String, data: Map, @@ -60,7 +64,7 @@ actual suspend fun HttpClient.uniUpload( ) else -> append( k, - stringFormat.encodeToString(v) + stringFormat.encodeToString(v::class.serializer() as SerializationStrategy, v) ) } }