DEV Community

David Smith
David Smith

Posted on

2

Passing Retrofit a client with FollowRedirect(false), but call is returning a 200 instead of expected 302

I have an app that is trying to get the auth code from a header. I have Retrofit configured as so:

private val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
private val httpClient = OkHttpClient.Builder().run {
    followRedirects(false)
    followSslRedirects(false)
    build()
}
private val retrofit = Retrofit.Builder().run {
    baseUrl(BASE_URL)
    client(httpClient)
    addConverterFactory(MoshiConverterFactory.create(moshi))
    build()
}

In the interface…

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more