We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Originally asked in https://stackoverflow.com/questions/78232043/feign-client-final-fields-of-payload-object-are-not-recognized-when-executing-p
In my code I have simple Feign client:
@FeignClient(name = "client", url = "${spring.microservice.tenant-auth.host}") public interface PerTenantTokenClient { @PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) ResponseEntity<AuthenticationResponse> getAuthToken(AuthFormData formData); }
aimed to execute the following request:
POST https://myhost.net/oauth/token Content-Type: application/x-www-form-urlencoded grant_type = client_credentials & client_id = id & client_secret = secret
getAuthToken() method accepts a payload DTO described as:
getAuthToken()
@RequiredArgsConstructor public class AuthFormData { private final String grant_type; private final String client_id; private final String client_secret; }
When I run this code snippet:
AuthFormData authFormData = new AuthFormData("client_credentials", "id", "secret"); var authTokenResponse = client.getAuthToken(authFormData);
it unexpectedly fails with 400:
[400 Bad Request] during [POST] to [https://myhost.net/oauth/token] [PerTenantTokenClient#getAuthToken(AuthFormData)]: [{ "error" : "invalid_request", "error_description" : "Missing parameter: grant_type" }]
However, if I remove final from AuthFormData fields' declaration the same code succeeds.
final
AuthFormData
I've tried to declare AuthFormData as Java record and it fails either (apparently due to implicit final on record members).
So my question is whether I'm facing a bug in feign client or something is wrong with my code? I use io.github.openfeign:feign-core:13.1 and Java 21
io.github.openfeign:feign-core:13.1
The text was updated successfully, but these errors were encountered:
As I see it's duplication of this issue: #2152
Sorry, something went wrong.
No branches or pull requests
Originally asked in https://stackoverflow.com/questions/78232043/feign-client-final-fields-of-payload-object-are-not-recognized-when-executing-p
In my code I have simple Feign client:
aimed to execute the following request:
getAuthToken()
method accepts a payload DTO described as:When I run this code snippet:
it unexpectedly fails with 400:
However, if I remove
final
fromAuthFormData
fields' declaration the same code succeeds.I've tried to declare
AuthFormData
as Java record and it fails either (apparently due to implicitfinal
on record members).So my question is whether I'm facing a bug in feign client or something is wrong with my code? I use
io.github.openfeign:feign-core:13.1
and Java 21The text was updated successfully, but these errors were encountered: