Hi, using ktor client, do I need to switch corout...
# ktor
s
Hi, using ktor client, do I need to switch coroutine context to the default dispatcher so that deserialization does not run on the main thread (Android)? I know that switching the context just for
get
is not neccessary, but I am not able to find any documentation regarding which thread is used to deserialize the response.
Copy code
// use client does not switch context
    override suspend fun getFoos(): CallResult<List<Foo>> =
        useClient { get("${baseUrl}/foos.json").body<List<Foo>>() }
a
The deserialization is executed with an
EmptyCoroutineContext
which means that the
Dispatchers.Default
dispatcher should be chosen.
s
Ok, thanks for providing this information 🙏