google / cronet-transport-for-okhttp

This package allows OkHttp and Retrofit users to use Cronet as their transport layer, benefiting from features like QUIC/HTTP3 support or connection migration.
Apache License 2.0
427 stars 31 forks source link

HttpLoggingInterceptor not logging after attaching CronetInterceptor #7

Closed parthivmistri closed 1 year ago

parthivmistri commented 1 year ago
val clientBuilder = OkHttpClient.Builder().apply {
            readTimeout(8, TimeUnit.SECONDS)
            connectTimeout(8, TimeUnit.SECONDS)
            addInterceptor(SomeInterceptor())
            addInterceptor(AuthInterceptor())
             addNetworkInterceptor(loggingInterceptor)
            cache(null)
            protocols(listOf(Protocol.QUIC, Protocol.HTTP_1_1))
        }
        clientBuilder.addInterceptor(
            CronetInterceptor.newBuilder(
                CronetEngine.Builder(context).enableQuic(true).build()
            ).build()
        )
clientBuilder.build()
Danstahrg commented 1 year ago

Hi Parthiv, using a Cronet interceptor bypasses all network interceptors, as discussed here: https://github.com/google/cronet-transport-for-okhttp#common-incompatibilities