SpotiFlyer/console-app/src/main/java/common/Common.kt

30 lines
808 B
Kotlin
Raw Normal View History

2021-06-19 22:46:59 +02:00
@file:Suppress("FunctionName")
package common
import io.ktor.client.HttpClient
import io.ktor.client.features.HttpTimeout
import io.ktor.client.features.json.JsonFeature
import io.ktor.client.features.json.serializer.KotlinxSerializer
import io.ktor.client.features.logging.DEFAULT
import io.ktor.client.features.logging.LogLevel
import io.ktor.client.features.logging.Logger
import io.ktor.client.features.logging.Logging
import kotlinx.serialization.json.Json
internal val client = HttpClient {
install(HttpTimeout)
install(JsonFeature) {
serializer = KotlinxSerializer(
Json {
ignoreUnknownKeys = true
isLenient = true
}
)
}
install(Logging) {
logger = Logger.DEFAULT
level = LogLevel.INFO
}
}