diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a59c841..bfbd2f6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,23 +1,16 @@ [versions] -agp = "8.7.0" -kotlin = "2.0.0" -coroutines-version = "1.8.1" -ktor = "2.3.12" -logbackClassicVersion = "1.5.8" -napier = "2.7.1" +agp = "8.7.3" +kotlin = "2.0.20" +coroutines-version = "1.9.0" +ktor = "3.0.2" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines-version" } ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" } -ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } -ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" } ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" } -ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" } -logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logbackClassicVersion" } -napier = { module = "io.github.aakira:napier", version.ref = "napier" } [plugins] androidLibrary = { id = "com.android.library", version.ref = "agp" } diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index b18ffc0..2432e82 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,16 +1,18 @@ import com.vanniktech.maven.publish.SonatypeHost +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidLibrary) - id("com.vanniktech.maven.publish") version "0.29.0" + id("com.vanniktech.maven.publish") version "0.30.0" } kotlin { androidTarget { - compilations.all { - kotlinOptions { - jvmTarget = "1.8" + tasks.withType().configureEach { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_1_8) } } } @@ -60,7 +62,7 @@ dependencies { mavenPublishing { coordinates( - groupId = "io.github.kabirnayeem99", artifactId = "ktor2curl", version = "1.0.1" + groupId = "io.github.kabirnayeem99", artifactId = "ktor2curl", version = "1.0.2" ) pom { diff --git a/shared/src/commonMain/kotlin/io/github/kabirnayeem99/ktor2curl/CurlCommandGenerator.kt b/shared/src/commonMain/kotlin/io/github/kabirnayeem99/ktor2curl/CurlCommandGenerator.kt index b6c5e5e..78c1ab1 100644 --- a/shared/src/commonMain/kotlin/io/github/kabirnayeem99/ktor2curl/CurlCommandGenerator.kt +++ b/shared/src/commonMain/kotlin/io/github/kabirnayeem99/ktor2curl/CurlCommandGenerator.kt @@ -63,8 +63,16 @@ internal fun HeadersBuilder.onHeaders( internal fun Any.onRequestBody(onBodyFound: (String) -> Unit) { val body = when (this) { - is TextContent -> io.ktor.utils.io.core.String(bytes()) - is ByteArrayContent -> io.ktor.utils.io.core.String(bytes()) + is TextContent -> { + val bytes = bytes() + bytes.decodeToString(0, 0 + bytes.size) + } + + is ByteArrayContent -> { + val bytes = bytes() + bytes.decodeToString(0, 0 + bytes.size) + } + is EmptyContent -> "" is MultiPartFormDataContent -> "[request body omitted]" is String -> this