ursus
05/26/2024, 5:13 PMMV
05/28/2024, 9:38 PMHttpClientConfig<OkHttpConfig>
ursus
05/28/2024, 9:38 PMthis
on the config
lambda?MV
05/28/2024, 9:44 PMfun API.setDefaultClientConfig(block: HttpClientConfig<OkHttpConfig>.() -> Unit) {
@Suppress("UNCHECKED_CAST")
defaultClient = defaultClient.config(block as HttpClientConfig<*>.() -> Unit)
}
ursus
05/28/2024, 9:44 PMursus
05/28/2024, 9:45 PMMV
05/28/2024, 9:57 PMursus
05/28/2024, 9:57 PMMV
05/28/2024, 9:57 PMursus
05/28/2024, 9:58 PMMV
05/28/2024, 9:58 PMursus
05/28/2024, 9:59 PMHttpClient
look like? do you keep it in common and expect/actual the engine somehow? or expect actual the whole createHttpClient
with distinct platform setups?
(I assume you have more setup on the instance other than passin in okhttp)ursus
05/28/2024, 10:00 PMokhttp
instance yourself?MV
05/28/2024, 10:17 PMursus
05/28/2024, 10:18 PMMV
05/28/2024, 10:18 PMursus
05/28/2024, 10:19 PMval client = HttpClient()
?MV
05/28/2024, 10:19 PMursus
05/28/2024, 10:20 PMpreconfigured
passing in
but for my interop story I need to pass that instance in and now not sure how should I set up my HttpClient instanceMV
05/28/2024, 10:21 PMursus
05/28/2024, 10:21 PMprivate val ktor = HttpClient(OkHttp) {
engine {
preconfigured = httpClient
}
}
ursus
05/28/2024, 10:22 PMAleksei Tirman [JB]
05/30/2024, 8:47 AMval defaultConfig = HttpClientConfig<OkHttpConfig>().apply {
engine {
preconfigured = httpClient
}
install(DefaultRequest) {
url("")
}
install(ContentNegotiation) {
json()
}
}
val ktor1 = HttpClient(OkHttp.create(), defaultConfig)
val newConfig = HttpClientConfig<OkHttpConfig>().apply {
plusAssign(defaultConfig)
engine {
preconfigured = httpClient
}
}
val ktor2 = HttpClient(OkHttp.create(), newConfig)
ursus
05/30/2024, 9:04 AM