Also, do you think it is better practice to call `...
# ktor
c
Also, do you think it is better practice to call
HttpClient()
in the common code, or to
expect
the client from each platform to have more granular settings (but maybe code duplication as well?)
r
I typically inject an
HttpClientEngine
that varies by platform and have a single
HttpClient
defined in common which uses it. Can inject via `expect`/`actual` or your favorite DI pattern from your platform code.
👍 1
c
Thanks, I'll look into that 👍
If you were working on a library that is mostly a wrapper around a single REST API, would you have a single long-running client for the lifetime of the program, or create/close it repeatedly (eg. On Android, when an activity dies or is created)?