HttpClientConfig

class HttpClientConfig<T : HttpClientEngineConfig>

Mutable configuration used by HttpClient.

Constructors

<init>

HttpClientConfig()

Mutable configuration used by HttpClient.

Properties

expectSuccess

var expectSuccess: Boolean

Terminate HttpClient.responsePipeline if status code is not success(>=300).

followRedirects

var followRedirects: Boolean

Use HttpRedirect feature to automatically follow redirects.

useDefaultTransformers

var useDefaultTransformers: Boolean

Use defaultTransformers to automatically handle simple ContentType.

Functions

clone

fun clone(): HttpClientConfig<T>

Clones this HttpClientConfig duplicating all the features and customInterceptors.

engine

fun engine(block: T.() -> Unit): Unit

install

fun <TBuilder : Any, TFeature : Any> install(
    feature: HttpClientFeature<TBuilder, TFeature>,
    configure: TBuilder.() -> Unit = {}
): Unit

Installs a specific feature and optionally configure it.

fun install(key: String, block: HttpClient.() -> Unit): Unit

Installs an interceptor defined by block. The key parameter is used as a unique name, that also prevents installing duplicated interceptors.

fun install(client: HttpClient): Unit

Applies all the installed features and customInterceptors from this configuration into the specified client.

plusAssign

operator fun plusAssign(other: HttpClientConfig<out T>): Unit

Install features from other client config.

Extension Functions

ResponseObserver

fun HttpClientConfig<*>.ResponseObserver(
    block: ResponseHandler
): Unit

Install ResponseObserver feature in client.

defaultRequest

fun HttpClientConfig<*>.defaultRequest(
    block: HttpRequestBuilder.() -> Unit
): Unit

Set request default parameters.