HttpClientConfig

A mutable HttpClient configuration. Learn more about the client's configuration from Creating and configuring a client.

Constructors

Link copied to clipboard

Functions

Link copied to clipboard

Clones this HttpClientConfig by duplicating all the plugins and customInterceptors.

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

Allows you to configure engine parameters.

Link copied to clipboard
fun install(client: HttpClient)

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

fun <TBuilder : Any, TPlugin : Any> install(plugin: HttpClientPlugin<TBuilder, TPlugin>, configure: TBuilder.() -> Unit = {})

Installs the specified plugin and optionally configures it using the configure block. Learn more from Plugins.

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>)

Installs the plugin from the other client's configuration.

Properties

Link copied to clipboard

Indicates whether the client should use development mode. In development mode, the client's pipelines have advanced stack traces.

Link copied to clipboard
var expectSuccess: Boolean = false

Terminates HttpClient.receivePipeline if the status code is not successful (>=300). Learn more from Response validation.

Link copied to clipboard

Specifies whether the client redirects to URLs provided in the Location header. You can disable redirections by setting this property to false.

Link copied to clipboard

Uses defaultTransformers to automatically handle simple ContentType.

Extensions

Link copied to clipboard

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

Link copied to clipboard

Installs the UserAgent plugin with a browser-like user agent.

Link copied to clipboard

Configure client charsets.

Link copied to clipboard

Installs the UserAgent plugin with a CURL user agent.

Link copied to clipboard

Set default request parameters. See DefaultRequest

Link copied to clipboard
Link copied to clipboard

Install ResponseObserver plugin in client.

Link copied to clipboard

Installs the WebSockets plugin using the config as configuration.