Lukasz Kalnik
07/08/2025, 8:16 AMHttpClient
is declared in the shared multiplatform part. How can I inject OkHttp
with the custom DNS into the shared part only for Android?simon.vergauwen
07/08/2025, 8:31 AMexpect fun createEngine(): HttpClientEngineFactory<T>
and return the OkHttp version from Android configured with your custom DSN, and the darwin version on iOS.
HttpClient(createEngine())
simon.vergauwen
07/08/2025, 8:32 AMLukasz Kalnik
07/08/2025, 8:35 AMT
in this case?simon.vergauwen
07/08/2025, 8:37 AMApache
. data object Apache : HttpClientEngineFactory<ApacheEngineConfig>
.
For data object OkHttp : HttpClientEngineFactory<OkHttpConfig>
which gives you access to the underlying
client for example. Reference: OkHttpConfig API Docssimon.vergauwen
07/08/2025, 8:38 AMval client: HttpClient = HttpClient(OkHttp) {
// configure OkHttp
}
Lukasz Kalnik
07/08/2025, 8:42 AMsimon.vergauwen
07/08/2025, 8:44 AMexpect fun createEngine(): HttpClientEngine
actual fun createEngine(): HttpClientEngine =
OkHttp.create {
// configure
}
Lukasz Kalnik
07/08/2025, 9:02 AM