tseisel
09/20/2019, 2:16 PMbaseUrl
= "https://foo.host.com/api/v1"
when calling httpClient.get("endpoint")
, then the resolved URL is <https://foo.host.com/api/v1/endpoint>
.Evan R.
09/20/2019, 4:57 PMrusshwolf
09/21/2019, 8:45 PMDefaultRequest
feature: https://ktor.io/clients/http-client/features/default-request.htmlhttpClient.get { url { encodedPath = "endpoint" } }
tseisel
09/23/2019, 12:20 PMval client = HttpClient(OkHttp) {
defaultRequest {
url {
protocol = URLProtocol.HTTPS
host = "<http://foo.host.com|foo.host.com>"
}
}
}
client.get<HttpResponse>(path = "api/v1/endpoint")
With that I can at least specify a common host.
Would be nice to have something similar to Retrofit's baseUrl
though. I'll consider writing a feature for that.