-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Request with Forms and Files requires the 'File' parameter to be listed first #4384
Comments
If I don't misunderstand of course, I don't quite agree with you that this is a bug. I think it was a design decision enforced by HTTP protocol. When you pass either |
I think, @harunyasar misunderstood the problem, as in both cases it's |
Oh I see. It might be a |
@harunyasar, it can't be a Swagger UI bug, as in my example I'm using |
@AKlaus I know what you are saying but what I am saying is that I suspect curl -X POST http://127.0.0.1:8000/test-fail -H "Content-Type: application/x-www-form-urlencoded" -d "param1=value1&file=value2" My theory is that there should be something wrong with |
Apparently, I am mistaken. |
Closing as a duplicate of #1964. Thank you @harunyasar for pointing out to that ticket! (I question my searching skills) |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
First Check
Commit to Help
Example Code
Description
BUG
The
File
parameter on the POST method must go first, before otherForm
parameters. Otherwise the end-point returns HTTP code 422.Details
A command line like below for the end-points from the example
would return HTTP code 200 with an expected result for
/test-success
and HTTP code 422 for/test-fail
with the following JSON:Expected behaviour
Validation of parameters doesn't depend on the order of the parameters
Operating System
macOS
Operating System Details
v12.0.1
FastAPI Version
0.70.1
Python Version
3.7.10
Additional Context
No response
The text was updated successfully, but these errors were encountered: