fromKtorClient

@ApiStatus.Experimental
fun KoogHttpClient.Companion.fromKtorClient(clientName: String, logger: KLogger, baseClient: HttpClient = io.ktor.client.HttpClient(), configurer: HttpClientConfig<out HttpClientEngineConfig>.() -> Unit): KoogHttpClient(source)

Creates a new instance of KoogHttpClient using a Ktor-based HTTP client for performing HTTP operations.

This function allows configuring the underlying Ktor HttpClient through the provided configuration lambda and enables enhanced logging, flexibility, and customization in HTTP interactions.

Return

An instance of KoogHttpClient configured with the provided parameters.

Parameters

clientName

The name of the client instance, used for identifying or logging client operations.

logger

A KLogger instance used for logging client events and errors.

baseClient

The base Ktor HttpClient instance to be used. Defaults to a new Ktor HttpClient instance.

configurer

A lambda function to configure the base Ktor HttpClient instance. It is applied using Ktor’s HttpClientConfig.