Hey what is d/w Android and OkHttp in HttpClient i...
# ktor
v
Hey what is d/w Android and OkHttp in HttpClient in ktor?
a
What do you mean?
v
a
What is d/w?
v
difference between
What is the difference between
Android
and
OkHttp
in
HttpClient
? I added example as well
Copy code
val client = HttpClient(Android)
or
Copy code
val client = HttpClient(OkHttp)
a
The difference is in the underlying implementation. The Android engine uses HttpURLConnection and the OkHttp engine uses the OkHttp client.
v
So which one you prefer to use
Android
or
OkHttp
? I want to implement interceptor and authenticator as well.
a
Both engines allow you to do it. I’d prefer using OkHttp because there are more options for configuring an underlying HTTP client.
v
thanks a million. For your suggestion. I tried
OkHttp
in my KMM module. I am getting this error. Can you please look this issue and guide me. Thanks
a
He was first :)
v
great thanks a million.
g
I really don’t like that this engine has name “Android” which is extremely misleading. There is nothing Android specific in it, it works on JVM with no problems, which expected, because it uses Java HttpUrlConnection, not some Android API. I created a change request about it, be free to vote for it, maybe it will cause less confusion https://youtrack.jetbrains.com/issue/KTOR-1013
🙏 1
a
You have my upvote. I am with you in this one @gildor