SpotiFlyer/console-app/src/main/java/common/Common.kt
2021-06-20 02:16:59 +05:30

30 lines
808 B
Kotlin

@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
}
}