Skip to content

Commit

Permalink
feat: Kotlin: make Transport class open for extension to allow custom…
Browse files Browse the repository at this point in the history
… HTTP Transports (#1519)

Fixes #1380 🦕
  • Loading branch information
chizhang-g authored Oct 11, 2024
1 parent 87b0976 commit 1c56a4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kotlin/src/main/com/looker/rtl/Transport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fun customInitializer(
}
}

class Transport(val options: TransportOptions) {
open class Transport(val options: TransportOptions) {

private val apiPath = "${options.baseUrl}/api/${options.apiVersion}"

Expand Down Expand Up @@ -240,7 +240,7 @@ class Transport(val options: TransportOptions) {
} + addQueryParams(path, queryParams)
}

private fun getAllTrustingVerifiers(): Pair<SSLSocketFactory, HostnameVerifier> {
open fun getAllTrustingVerifiers(): Pair<SSLSocketFactory, HostnameVerifier> {
// NOTE! This is completely insecure and should ONLY be used with local server instance
// testing for development purposes
val tm: X509TrustManager = object : X509TrustManager {
Expand Down Expand Up @@ -276,7 +276,7 @@ class Transport(val options: TransportOptions) {
*
* Will disable SSL certificate verification iff [TransportOptions.verifySSL] is false.
*/
fun initTransport(options: TransportOptions): HttpTransport {
open fun initTransport(options: TransportOptions): HttpTransport {
return when (HttpTransports.valueOf(options.httpTransport.uppercase())) {
HttpTransports.APACHE -> {
// TODO: fix bug upstream that does not pass client context to requests.
Expand Down

0 comments on commit 1c56a4c

Please sign in to comment.