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

Archie

11/12/2020, 8:42 AM
Hi have anyone work with making Ktor Client and Coil-Kt work together? I need to configure Ktor and Coil to use the same configuration, (Default Request, Interceptor, Auth, etc. etc.) But
Ktor
require
HttpClientEngine
but
Coil
needs the
OkHttpClient
itself. Is there a way to make both work together?
r

Rustam Siniukov

11/12/2020, 1:07 PM
you can pass your
OkHttpClient
instance to Ktor client like this
Copy code
HttpClient(OkHttp) {
  engine { preconfigured = okHttpClient }
}
👍 1
😮 1
a

Archie

11/12/2020, 1:09 PM
oh i see... thank you very much!