Skip to main content

Kotlin

ktor‚Äč

gradle.properties
ktor_version=2.1.1
build.gradle.kts
dependencies {
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-cio:$ktor_version")
}
Main.kt
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*

val response: HttpResponse = client.get("https://uuidgen.dev/")
val uuid: String = httpResponse.body()
println("${uuid}")