-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
Connexion 2.1.0 doesn't parse the request body using the right content types when more types are present #805
Comments
please attach a spec so I can reproduce the problem, otherwise it is impossible to help you. |
potentially related to #812 |
Okay, I had more of a look at it. Here's the relevant code: Init connexion
Swagger file:
It seems no parameters get sent to the login function and it doesn't actually provide an error if parameters are missing. |
Okay, tried to change things. It seems the |
Thanks for reporting back! That's really useful information for a branch I'm working on for adding validation/de-serialization per content-type. (#760) |
A couple more things for this:
Adding multiple content types gives all kinds of problems. When I tried this it'll say For now I can solve this by just using JSON everywhere, but it seems it doesn't see the Content-Type header. So ... Actual behavior: |
Supporting multiple content types is a known issue, and is not new to connexion 2 ( #655 ). |
Okay – I can see how your PR could break existing apps if that PR is implemented, so perhaps it makes sense to make a new flag that the content type header should be used? Otherwise it looks good. As far as I can see the main thing is that most clients may treat json- or form-encoding as substituting each other. For instance when testing an API it's typically easier to use form encoding in Postman than JSON-encoding and ajax clients don't necessarily always specify if they send the request JSON- or form-encoded. This is extra true when making an API for public consumption where the different encodings are often all accepted |
Fixed in #1588 |
Description
I updated Connexion to version 2.0.2 but none of my routes got any parameters sent. I got the expected behaviour when I accessed the routes with missing params (ie, error), but the params didn't get sent to the controller functions (no params were sent).
Expected behaviour
I expected that the the parameters would be sent to the controller function like before. Instead no arguments are sent when hitting the endpoint.
Actual behaviour
No parameters are sent to the controller function. Not sure if this is new expected behaviour or there's a bug somewhere along the line. Alternatively I would assume there's a global object that holds the parameters?
Steps to reproduce
Just a normal setup – a swagger file to describe the API and a controller script with functions to handle each route. The function for the route expects either named or positional arguments. This is what works in 1.5.3 but not in 2.0.2
Additional info:
Python version 3.7.0
It's very possible there's another way to get the parameters and I would love to hear about that. Right now I've had to downgrade Flask. If I just missed something about the new Connexion I would be happy to hear about it :)
The text was updated successfully, but these errors were encountered: