diff --git a/elasticmagic-transport-ktor/src/commonMain/kotlin/dev/evo/elasticmagic/transport/ElasticsearchKtorTransport.kt b/elasticmagic-transport-ktor/src/commonMain/kotlin/dev/evo/elasticmagic/transport/ElasticsearchKtorTransport.kt index ca9012170a..eb1fb62eed 100644 --- a/elasticmagic-transport-ktor/src/commonMain/kotlin/dev/evo/elasticmagic/transport/ElasticsearchKtorTransport.kt +++ b/elasticmagic-transport-ktor/src/commonMain/kotlin/dev/evo/elasticmagic/transport/ElasticsearchKtorTransport.kt @@ -1,6 +1,7 @@ package dev.evo.elasticmagic.transport import io.ktor.client.HttpClient +import io.ktor.client.HttpClientConfig import io.ktor.client.engine.HttpClientEngine import io.ktor.client.plugins.auth.Auth import io.ktor.client.plugins.auth.providers.basic @@ -21,6 +22,7 @@ import io.ktor.http.takeFrom class ElasticsearchKtorTransport( baseUrl: String, engine: HttpClientEngine, + val customHttpClientConfig: HttpClientConfig<*>.() -> Unit = {}, configure: Config.() -> Unit = {}, ) : ElasticsearchTransport( baseUrl, @@ -29,6 +31,8 @@ class ElasticsearchKtorTransport( private val client = HttpClient(engine) { expectSuccess = false + customHttpClientConfig(this) + // Enable compressed response from Elasticsearch if (config.gzipRequests) { install(ContentEncoding) {