Package io.ktor.client.engine

Types

HttpClientEngine

interface HttpClientEngine : CoroutineScope, Closeable

Base interface use to define engines for HttpClient.

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.

HttpClientEngineCapability

interface HttpClientEngineCapability<T>

Capability required by request to be supported by HttpClientEngine with T representing type of the capability configuration.

HttpClientEngineConfig

open class HttpClientEngineConfig

Base configuration for HttpClientEngine.

HttpClientEngineFactory

interface HttpClientEngineFactory<out T : HttpClientEngineConfig>

Factory of HttpClientEngine with a specific T of HttpClientEngineConfig.

HttpClientJvmEngine

abstract class HttpClientJvmEngine : HttpClientEngine

Base jvm implementation for HttpClientEngine

ProxyBuilder

expect object ProxyBuilder

ProxyConfig factory.

ProxyConfig

expect class ProxyConfig

Proxy configuration.

Exceptions

ClientEngineClosedException

class ClientEngineClosedException : IllegalStateException

Exception that indicates that client engine is already closed.

Type Aliases

ProxyConfig

actual typealias ProxyConfig = Proxy

Proxy configuration.

Properties

DEFAULT_CAPABILITIES

val DEFAULT_CAPABILITIES: Set<HttpTimeout.Feature>

Default capabilities expected to be supported by engine.

KTOR_DEFAULT_USER_AGENT

val KTOR_DEFAULT_USER_AGENT: String

Default user agent to use in ktor client.

Functions

callContext

suspend fun callContext(): <ERROR CLASS>

Returns current call context if exists, otherwise null.

config

fun <T : HttpClientEngineConfig> HttpClientEngineFactory<T>.config(
    nested: T.() -> Unit
): HttpClientEngineFactory<T>

Creates a new HttpClientEngineFactory based on this one with further configurations from the nested block.

http

fun ProxyBuilder.http(urlString: String): ProxyConfig

Create http proxy from urlString.

mergeHeaders

fun mergeHeaders(
    requestHeaders: Headers,
    content: OutgoingContent,
    block: (key: String, value: String) -> Unit
): Unit

Merge headers from content and requestHeaders according to OutgoingContent properties