Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feedback] Chucker usage with Ktor HTTP client #177

Closed
psh opened this issue Jan 5, 2020 · 2 comments
Closed

[Feedback] Chucker usage with Ktor HTTP client #177

psh opened this issue Jan 5, 2020 · 2 comments

Comments

@psh
Copy link
Contributor

psh commented Jan 5, 2020

I spent some time learning about the Ktor HTTP client recently, porting the HttpBinClient and HttpBinApi to the Ktor HTTP client as a learning exercise for myself.

In the process I was happy to find that Chucker works perfectly with the Ktor HTTP client when configured to use the OkHttp engine -

private val httpClient = HttpClient(OkHttp) {
    install(JsonFeature) {
        serializer = GsonSerializer()
    }
    engine {
        addInterceptor(chuckerInterceptor)
        addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
        config {
            followRedirects(true)
            readTimeout(30, TimeUnit.SECONDS)
            connectTimeout(30, TimeUnit.SECONDS)
            callTimeout(30, TimeUnit.SECONDS)
        }
    }
}

👍 Great work all!

@cortinico
Copy link
Member

Awesome! Thanks for sharing this @psh!

@GuilhE
Copy link

GuilhE commented May 27, 2021

Just to add my 2 cents, I've configured my HttpClient throughout expect/actual logic in a KMM project and Chucker runs happily on androidApp 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants