diff --git a/core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt b/core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt index 74cd8c78b..c03d87a83 100644 --- a/core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt +++ b/core/src/main/kotlin/com/expediagroup/sdk/core/client/BaseXapClient.kt @@ -23,6 +23,7 @@ import com.expediagroup.sdk.core.plugin.authentication.strategy.AuthenticationSt import io.ktor.client.HttpClient import io.ktor.client.engine.HttpClientEngine import io.ktor.client.engine.okhttp.* +import okhttp3.OkHttpClient /** * The integration point between the SDK Core and the product SDKs. @@ -62,4 +63,20 @@ abstract class BaseXapClient( /** A [BaseXapClient] builder. */ @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients. abstract class Builder> : HttpConfigurableBuilder() + + /** A [BaseXapClient] builder with ability to pass a custom okhttp client. */ + @Suppress("unused", "UnnecessaryAbstractClass") // This is used by the generated SDK clients. + abstract class BuilderWithHttpClient> : Client.Builder() { + protected var okHttpClient: OkHttpClient? = null + + @Suppress("UNCHECKED_CAST") + override fun self(): SELF = this as SELF + + /** Sets the [OkHttpClient] to use for the [BaseXapClient]. */ + fun okHttpClient(okHttpClient: OkHttpClient): SELF { + this.okHttpClient = okHttpClient + return self() + } + + } }