HttpClient

fun <T : HttpClientEngineConfig> HttpClient(engineFactory: HttpClientEngineFactory<T>, block: HttpClientConfig<T>.() -> Unit = {}): HttpClient

Constructs an asynchronous HttpClient using the specified engineFactory and an optional block for configuring this client.


fun HttpClient(engine: HttpClientEngine, block: HttpClientConfig<*>.() -> Unit): HttpClient

Constructs an asynchronous HttpClient using the specified engine and a block for configuring this client.


expect fun HttpClient(block: HttpClientConfig<*>.() -> Unit = {}): HttpClient

Constructs an asynchronous HttpClient using optional block for configuring this client.

The HttpClientEngine is selected from the dependencies. https://ktor.io/clients/http-client/engines.html

actual fun HttpClient(block: HttpClientConfig<*>.() -> Unit = {}): HttpClient

Constructs an asynchronous HttpClient using optional block for configuring this client.

The HttpClientEngine is selected from the dependencies using ServiceLoader. The first found implementation that provides HttpClientEngineContainer service implementation is used. An exception is thrown if no implementations found.

See https://ktor.io/clients/http-client/engines.html

actual fun HttpClient(block: HttpClientConfig<*>.() -> Unit = {}): HttpClient

Constructs an asynchronous HttpClient using optional block for configuring this client.

The HttpClientEngine is selected from the dependencies. https://ktor.io/clients/http-client/engines.html