commonMain.io.github.alexzhirkevich.compottie.DefaultHttpClient.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compottie-network-desktop Show documentation
Show all versions of compottie-network-desktop Show documentation
Compose Multiplatform lottie animation
The newest version!
package io.github.alexzhirkevich.compottie
import io.ktor.client.HttpClient
import io.ktor.client.plugins.HttpRequestRetry
import io.ktor.client.request.get
import io.ktor.client.statement.bodyAsBytes
import io.ktor.client.statement.bodyAsChannel
import io.ktor.utils.io.InternalAPI
import io.ktor.utils.io.toByteArray
internal val DefaultHttpClient by lazy {
HttpClient {
followRedirects = true
expectSuccess = true
install(HttpRequestRetry) {
maxRetries = 2
constantDelay(1000, 500)
}
}
}
@OptIn(InternalAPI::class)
internal val DefaultHttpRequest : suspend (String) -> ByteArray = {
DefaultHttpClient.get(it).bodyAsBytes()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy