KtorHttpExecutor

class KtorHttpExecutor(val httpClient: HttpClient = HttpClient(OkHttp) { install(HttpTimeout) { requestTimeoutMillis = 15_000L // 15 seconds connectTimeoutMillis = 10_000L // 10 seconds } install(HttpCookies) install(HttpCache) }) : ApiExecutor

An ApiExecutor implementation that uses Ktor for making HTTP requests.

This executor can be configured with different timeout values. For more advanced customization, such as adding custom interceptors or plugins, you can create a pre-configured Ktor HttpClient and pass it to this class's constructor. The resulting KtorHttpExecutor instance can then be assigned to the DirectAuthenticationFlowBuilder.apiExecutor property.

See the Ktor Client documentation for more information on configuring Ktor clients.

Parameters

httpClient

The Ktor HttpClient to use for network requests. By default, a client is created using the OkHttp engine with HttpTimeout, HttpCookies, and HttpCache plugins installed.

The timeout values can be adjusted in the default client by modifying the values in the HttpTimeout configuration block.

The HttpCookies and HttpCache plugins are default in memory implementations and can be replaced by configuring your own HttpClient instance.

Constructors

Link copied to clipboard
constructor(httpClient: HttpClient = HttpClient(OkHttp) { install(HttpTimeout) { requestTimeoutMillis = 15_000L // 15 seconds connectTimeoutMillis = 10_000L // 10 seconds } install(HttpCookies) install(HttpCache) })

Properties

Link copied to clipboard
val httpClient: HttpClient

Functions

Link copied to clipboard
open suspend override fun execute(request: ApiRequest): Result<ApiResponse>