-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
Support JDK HttpClient in ClientHttpRequestFactories #36118
Conversation
I've opened #36120 so that |
Any chance this can make it into boot 3.2.0-M1? |
I would hope so, yeah. |
This commit introduces support for the JdkClientHttpRequestFactory in ClientHttpRequestFactories.
0b6f142
to
a2cb968
Compare
@wilkinsona Thanks, using |
Lines 58 to 63 in 9273a76
Previously it used Given that anyone who was using |
See https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.Builder.html#followRedirects(java.net.http.HttpClient.Redirect). The default is |
Yeah, I think so. Specifically, aligning with the behavior of |
The default |
@poutsma Do you think it's worth adding a Framework test as well? It might be hard to catch regressions if |
Thanks for the redirect change, @poutsma. Unfortunately, I've now hit another problem that's related to redirects. This time it involves the We have a test that makes a
Unlike the simple client that only follows redirects for
This redirect is also followed so a It looks to me like we have two competing requirements that cannot both be satisfied. To match the behavior of the simple request factory we need to follow redirects but only for If we introduce support for |
From a Framework perspective, I'm not that comfortable with changing more defaults in the Would it make sense to have different defaults? |
Just five cents from an user It' s a new version (3.2), I think it's okay to change the behaviour |
Understood. I'd prefer to align with Framework's defaults in Boot as well if we can, I imagine for similar reasons.
I'd prefer not to do that. I think it may be confusing and it would mean that If this comes down to a straight choice between That will leave us with a problem in Boot for those who were using |
Agreed. I must admit that I already felt a bit bothered about changing the default redirect policy, because I don't think we change defaults in any other http client.
Agreed. |
Thanks, @poutsma. Sounds like we're in agreement then and that, I assume, spring-projects/spring-framework@7c37f4b will be reverted. |
|
The Boot team discussed this a bit today and decided that we think our best option for now is to add support for |
This commit introduces support for the JdkClientHttpRequestFactory in ClientHttpRequestFactories.
Notes:
JdkClientHttpRequestFactory
is preferred to theSimpleClientHttpRequestFactory
if thejava.net.http
module is loaded. As a consequence, several tests that expectSimpleClientHttpRequestFactory
fail, and because@ClassPathExclusions
cannot be used in this situation, I am unsure how to proceed. Perhaps a new@ModuleExclusions
annotation is necessary?