Guilherme Delgado
03/31/2021, 12:20 AMprivate fun createHttpClient(enableNetworkLogs: Boolean) = HttpClient {
install(JsonFeature) {
serializer = KotlinxSerializer(kotlinx.serialization.json.Json {
isLenient = true
ignoreUnknownKeys = true
serializersModule = SerializersModule { contextual(MyCustomSerializer) }
})
}
if (enableNetworkLogs) {
install(Logging) {
logger = Logger.DEFAULT
level = LogLevel.ALL
}
}
}
Applied only to a specific request (without creating a different client)
suspend fun fetchData(): List<Something> = client.<configure specific serializersModule for this request>.get(...)
?
Thanks for your time!
ps: this is my ktor configuration for KMM commonModule. Maybe the question is in the wrong channel 😕 sorry in advanceRustam Siniukov
03/31/2021, 1:49 PMGuilherme Delgado
03/31/2021, 1:52 PM