HttpClientConfig

class HttpClientConfig<T : HttpClientEngineConfig>

Mutable configuration used by HttpClient.

Constructors

Link copied to clipboard
fun HttpClientConfig()

Functions

Link copied to clipboard
fun clone(): HttpClientConfig<T>

Clones this HttpClientConfig duplicating all the features and customInterceptors.

Link copied to clipboard
fun engine(block: T.() -> Unit)

Configure engine parameters.

Link copied to clipboard
fun install(client: HttpClient)

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

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

Installs a specific feature and optionally configure it.

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

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

Link copied to clipboard
operator fun plusAssign(other: HttpClientConfig<out T>)

Install features from other client config.

Properties

Link copied to clipboard
var developmentMode: Boolean

Indicate if client should use development mode. In development mode client pipelines have advanced stack traces.

Link copied to clipboard
var expectSuccess: Boolean

Terminate HttpClient.receivePipeline if status code is not successful (>=300).

Link copied to clipboard
var followRedirects: Boolean

Use HttpRedirect feature to automatically follow redirects.

Link copied to clipboard
var useDefaultTransformers: Boolean

Use defaultTransformers to automatically handle simple ContentType.

Extensions

Link copied to clipboard
fun HttpClientConfig<*>.addDefaultResponseValidation()

Default response validation. Check the response status code in range (0..299).

Link copied to clipboard
fun HttpClientConfig<*>.BrowserUserAgent()

Install UserAgent feature with browser-like user agent.

Link copied to clipboard
fun HttpClientConfig<*>.Charsets(block: HttpPlainText.Config.() -> Unit)

Configure client charsets.

Link copied to clipboard
fun HttpClientConfig<*>.CurlUserAgent()

Install UserAgent feature with browser-like user agent.

Link copied to clipboard
fun HttpClientConfig<*>.defaultRequest(block: HttpRequestBuilder.() -> Unit)

Set request default parameters.

Link copied to clipboard
fun HttpClientConfig<*>.HttpResponseValidator(block: HttpCallValidator.Config.() -> Unit)

Install HttpCallValidator with block configuration.

Link copied to clipboard
fun HttpClientConfig<*>.ResponseObserver(block: ResponseHandler)

Install ResponseObserver feature in client.

Link copied to clipboard
fun HttpClientConfig<*>.WebSockets(config: WebSockets.Config.() -> Unit)

Install WebSockets feature using the config as configuration.