You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though the HTTP method was changed to POST, the body was empty (Content-Length: 0).
So:
The request became POST,
But no request body was actually sent,
And there was no error or warning during Feign request generation.
Important note
When I explicitly add @RequestParam, everything works correctly:
@FeignClient(name = "test-client")
publicinterfaceTestClient {
@GetMapping("/test")
DataRsgetData(@RequestParamStringquery); // ✅ Works as intended: GET with query string
}
So I fully understand that @RequestParam is needed when sending query parameters.
Suggestion
Given this behavior, I would like to ask:
Wouldn't it be more appropriate for OpenFeign to throw a warning or an error early — for example, during startup or client creation — if it detects a GET method that has parameters but is missing annotations like @RequestParam or @SpringQueryMap?
In many cases, when a developer defines a GET method with parameters, the expected behavior is to send those as query parameters, not as a body.
If the annotation is missing, and OpenFeign ends up silently treating the request as a POST with an empty body, it can easily cause confusion, unexpected behavior, or even runtime issues under strict API gateways or HTTP method validation rules.
Additionally, when I checked the client-side logs, it still showed the request being sent as a GET,
but when I confirmed with the receiving server, the request was actually received as a POST.
This discrepancy made it very difficult to quickly identify and debug the issue.
In my local logging, using the following RequestInterceptor:
the request was logged as being sent with the GET method.
However, on the server side that received the API request, it was actually received as a POST request.
I fully understand that @RequestParam is necessary when intending to send query parameters.
However, it seems like providing an early warning in cases where a GET method's parameters would be treated incorrectly could greatly help developers catch such issues before runtime.
If there is a particular reason why OpenFeign currently does not enforce this behavior — for example, to preserve flexibility or for backward compatibility — I would be happy to understand that as well.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Description
When using OpenFeign, I originally intended to send a query parameter with a GET request.
For example:
My goal was to send the request like:
What actually happened
query
parameter was not annotated with@RequestParam
, OpenFeign treated it as a request body.HttpURLConnection
) automatically changed the method to POST at runtime:Even though the HTTP method was changed to POST, the body was empty (Content-Length: 0).
So:
Important note
Suggestion
Given this behavior, I would like to ask:
Wouldn't it be more appropriate for OpenFeign to throw a warning or an error early — for example, during startup or client creation — if it detects a GET method that has parameters but is missing annotations like @RequestParam or @SpringQueryMap?
In many cases, when a developer defines a GET method with parameters, the expected behavior is to send those as query parameters, not as a body.
If the annotation is missing, and OpenFeign ends up silently treating the request as a POST with an empty body, it can easily cause confusion, unexpected behavior, or even runtime issues under strict API gateways or HTTP method validation rules.
Additionally, when I checked the client-side logs, it still showed the request being sent as a GET,
but when I confirmed with the receiving server, the request was actually received as a POST.
This discrepancy made it very difficult to quickly identify and debug the issue.
In my local logging, using the following RequestInterceptor:
the request was logged as being sent with the GET method.
However, on the server side that received the API request, it was actually received as a POST request.
I fully understand that @RequestParam is necessary when intending to send query parameters.
However, it seems like providing an early warning in cases where a GET method's parameters would be treated incorrectly could greatly help developers catch such issues before runtime.
If there is a particular reason why OpenFeign currently does not enforce this behavior — for example, to preserve flexibility or for backward compatibility — I would be happy to understand that as well.
The text was updated successfully, but these errors were encountered: