-
Notifications
You must be signed in to change notification settings - Fork 38.5k
RestClient Bean can not call API with method GET contains body #32948
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
Comments
Thanks for the sample. The underlying The former is new in 6.1 and Spring Boot couldn't swap the default behavior for backward compatible reason, see spring-projects/spring-boot#38856 and the issue that it links. I am not sure why |
I've tracked this behavior to #10207. This is because See the JDK code in action here: https://github.com/openjdk/jdk/blob/jdk-23%2B25/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java#L1431-L1433 You can verify that in action without Spring being involved with:
This will send the request as a POST:
In this case @ngocnhan-tran1996 , please use a different request factory for your client. You can configure the request factory manually for your entire application or add a library on the classpath that will be picked up instead of the default one. |
Context
I have to call an API have body with method GET and I use
RestClient
Issue
I create bean
RestClient
by this wayThe way I call API
When I call API, the reponse like
But if I create bean by this way, I can call API
How to reproduce
I have a demo in this repo. Please take a look and tell me if I miss something.
https://github.com/ngocnhan-tran1996/restclient-demo
Spring version: 3.3.0
Java version: 22
The text was updated successfully, but these errors were encountered: