ursus
05/26/2024, 5:07 PMprivate val ktor = HttpClient(OkHttp) {
engine {
preconfigured = httpClient
}
install(DefaultRequest) {
url("<http://10.0.2.2:8080/>")
}
install(ContentNegotiation) {
json(json)
}
}
I have a okhttp backed ktor client instance.
I'm currently migrating from retrofit to ktor
I have 2 okhttp instances (which are shallow copies of the previous ones + added functionality) (baseOkHttp > userOkhttp)
With retrofit I did this
@JvmStatic
@Provides
@UserScope
@UserQualifier
fun userRetrofit(
@UserQualifier userOkHttpClient: OkHttpClient,
@BaseQualifier baseRetrofit: Retrofit
): Retrofit {
return baseRetrofit.newBuilder()
.client(userOkHttpClient)
.build()
so..I copy previous retrofit's config .. which I presume is ktor.config { .. }
but there I cannot seem to be able to swap a okhttp instance?
Or am I?