Ktor: OkHttp engine ignores preconfigured OkHttpClient in 1.3.1

Created on 13 Feb 2020  路  2Comments  路  Source: ktorio/ktor

Ktor Version and Engine Used (client or server and name)
version, client/server, additional ktor modules included
1.3.1, client, ktor-client-okhttp

Describe the bug
OkHttp engine ignores preconfigured OkHttpClient in 1.3.1. This works just fine with 1.3.0 though.

To Reproduce

  1. Create an instance of OkHttpClient with HttpLoggingInterceptor with your favorite logger.
  2. Create an instance of HttpClient with OkHttp engine that has the following configuration:
fun createHttpClient(client: OkHttpClient) = HttpClient(OkHttp) {
    engine { preconfigured = client }
}
  1. Make some HTTP calls
  2. Find that nothing was logged

Expected behavior
Use preconfigured OkHttpClient if set.

bug

Most helpful comment

Hi @drymarev,

Thanks for reporting, it looks like a critical issue. I think I understood the root cause, so I prepared PR with the fix (https://github.com/ktorio/ktor/pull/1648).

All 2 comments

Hi @drymarev,

Thanks for reporting, it looks like a critical issue. I think I understood the root cause, so I prepared PR with the fix (https://github.com/ktorio/ktor/pull/1648).

I merged the fix, so it will be available in 1.3.2.

Was this page helpful?
0 / 5 - 0 ratings