RedirectHandler appears to be redundant for default configuration
followRedirects(false) isn't called on the default OkHttpClient builder and so redirects are followed upstream from kiota, this makes RedirectHandler a little confusing.
Forgive me If this is known and intentional, it tripped me up for a while.
Hi @p-m-j Thank you for using kiota and for reaching out.
I think this is an oversight on our end, we meant to align java with the other languages, and disable the default redirection following behaviour.
Is this something you'd like to submit a pull request for provided some guidance?
@baywet I'm happy to submit a PR (nice to see that the CLA setup looks pretty painless 👍).
Guide away!
The factory that sets up the default http client is here.
https://github.com/microsoft/kiota-java/blob/c4684aba16e23bcfa7da4793e6f6b8233b1b8e40/components/http/okHttp/src/main/java/com/microsoft/kiota/http/KiotaClientFactory.java#L59
And you can add an additional unit test here to prevent future regressions on the setup https://github.com/microsoft/kiota-java/blob/c4684aba16e23bcfa7da4793e6f6b8233b1b8e40/components/http/okHttp/src/test/java/com/microsoft/kiota/http/KiotaClientFactoryTest.java#L33
Optional, the redirect handler does not have any unit test 😱 But if you also want to take on that extra work, you could add a new file here https://github.com/microsoft/kiota-java/tree/main/components/http/okHttp/src/test/java/com/microsoft/kiota/http/middleware
Let me know if you have any additional comments or questions.
Apologies for the turnaround time @baywet, the folks that pay the bills have kept me pretty busy.