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

Ovsyannikov Alexey

08/09/2022, 5:56 PM
Hello 🙂 Is it possible in ktor clients to change default request url on the fly (after config) ?
a

Aleksei Tirman [JB]

08/09/2022, 6:45 PM
No, but you can create a new client with overridden config:
Copy code
val client = HttpClient(Apache) {
    defaultRequest { 
        url("<http://example.com>")
    }
}

val newClient = client.config {
    defaultRequest {
        url("<http://httpbin.org/get>")
    }
}
👍 1
4 Views