-
Notifications
You must be signed in to change notification settings - Fork 1.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
Params order: "Body parameters cannot be used with form parameters." #561
Comments
We ended up running into this issue because one of our path param had an underscore in it. Doesn't seem like you're running into that here, but maybe this will help someone in the future running into the same issue. |
I had a "-" in the path parameter and was getting the same problem. The error resolved on making the parameter camelcase. |
Sounds like something we should make clearer in the documentation. |
I'm not really sure why a |
I've done some more research into this and this exception is thrown during contract parsing when we encounter a Feign will treat method parameters annotated this way as /*
* This will cause an exception. username and password will be treated as
* application/www-form-urlencoded request body parameters and Credentials
* are also being supplied as part of the request body. We cannot support both
*/
@RequestLine("POST /authenticate")
public User authenticate(
@Param("username") String username,
@Param("password") String password,
Credentials credentials); Admittedly, the In this particular case, there was a bug in If anyone here is still experiencing this issue, can they test with version 10.7 and report if the issue is resolved? |
Also #1144 has been merged and should correct any additional scenarios. |
Relates to #561 Corrects inconsistent processing during Contract parsing with `formParams` are mixed with `@Body` parameters where order of parameters mattered, when it shouldn't. Test Case: ```java @RequestLine("POST /") void formParamAndBodyParams( @param("customer_name") String customer, String body); @RequestLine("POST /") void bodyParamsAndformParam( String body, @param("customer_name") String customer); ```
I am using 10.8 version , I am getting an exception saying "Body parameters cannot be used with form parameters." Below is my contract ArrangementResponse createArrangement( |
@ganeshabg on 10.9 feign adds more details to error message, would recommend using that version. |
Still an issue with feign-core 11.8 and fein-form 3.8.0. Manually moving the RequestBody to be the first param works, which is problematic if the code is generated. |
Hi,
This issue has already been discussed in #399.
I got the same error with Feign 8.18.0, on a Swagger-codegen generated client (so i cannot modify the client). The annotations used are the good ones (feign.param for path params).
Interface :
Error:
java.lang.IllegalStateException: Body parameters cannot be used with form parameters.
However, if I change params order (body in first or second place) manually in the generated code, it works.
The text was updated successfully, but these errors were encountered: