KtorDsl
object KtorDsl
A DSL object providing factory methods and utilities for Ktor HttpClient operations.
Supports both suspending and blocking HTTP request patterns with automatic client lifecycle management.
Functions
Link copied to clipboard
Link copied to clipboard
suspend fun <T> httpClient(httpClient: HttpClient? = null, expectSuccess: Boolean = false, block: suspend (HttpClient) -> T): T
Executes block with an HttpClient passed as a parameter. If httpClient is null, a new client is created and automatically closed after the block completes.
Link copied to clipboard
Creates a new HttpClient configured with HttpTimeout support.
Link copied to clipboard
suspend fun <T> withHttpClient(httpClient: HttpClient? = null, expectSuccess: Boolean = false, block: suspend HttpClient.() -> T): T
Executes block with an HttpClient as the receiver. If httpClient is null, a new client is created and automatically closed after the block completes.