https://kotlinlang.org logo
#ktor
Title
# ktor
p

Peter

12/08/2021, 4:16 PM
what’s the canonical way to create a URL string literal with encoded parameters?
i’ve been doing this which doesn’t feel like the best way:
Copy code
handleRequest(HttpMethod.Get, "/login?${listOf("redirectUrl" to clientRedirectURL).formUrlEncode()}")
a

Aleksei Tirman [JB]

12/09/2021, 7:29 AM
Copy code
val builder = URLBuilder().apply {
    encodedPath = "/login"
    parameters.append("redirectUrl", "<https://www.google.com/>")
}
val url = builder.build()
println(url.fullPath)
👍 1
2 Views