ktor-client-core / io.ktor.client.engine / HttpClientEngine

HttpClientEngine

interface HttpClientEngine : CoroutineScope

Base interface use to define engines for HttpClient.

Properties

config

abstract val config: HttpClientEngineConfig

Engine configuration

dispatcher

abstract val dispatcher: CoroutineDispatcher

CoroutineDispatcher specified for io operations.

supportedCapabilities

open val supportedCapabilities: Set<HttpClientEngineCapability<*>>

Set of supported engine extensions.

Functions

execute

abstract suspend fun execute(data: HttpRequestData): HttpResponseData

Creates a new HttpClientCall specific for this engine, using a request data.

install

open fun install(client: HttpClient): Unit

Install engine into HttpClient.

Extension Functions

mapEngineExceptions

fun CoroutineScope.mapEngineExceptions(input: ByteReadChannel, request: HttpRequestData): ByteReadChannel

Returns ByteReadChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException.

fun CoroutineScope.mapEngineExceptions(output: ByteWriteChannel, request: HttpRequestData): ByteWriteChannel

Returns ByteWriteChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException.

Inheritors

HttpClientEngineBase

abstract class HttpClientEngineBase : HttpClientEngine

Abstract implementation of HttpClientEngine responsible for lifecycle control of dispatcher and coroutineContext as well as proper call context management. Should be considered as the best parent class for custom HttpClientEngine implementations.

HttpClientJvmEngine

abstract class HttpClientJvmEngine : HttpClientEngine

Base jvm implementation for HttpClientEngine