All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.earth.worldwind.util.http.DefaultHttpClient.kt Maven / Gradle / Ivy

package earth.worldwind.util.http

import io.ktor.client.*
import io.ktor.client.plugins.*

/**
 * Returns new platform-dependent HTTP client instance configured by default.
 * In case some special configuration will be required on each platform, then make this function "expected".
 */
@Suppress("FunctionName")
fun DefaultHttpClient(
    connectTimeout: Long = 3000L,
    requestTimeout: Long = 30000L,
    config: HttpClientConfig<*>.() -> Unit = {}
) = HttpClient {
    config(this)

    install(HttpTimeout) {
        connectTimeoutMillis = connectTimeout
        requestTimeoutMillis = requestTimeout
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy