Skip to content
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

🐛 Fix #9116 Form and File parameters order should not matter #11194

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

thomasleveil
Copy link

This PR updates the fix (6185a92) from @jsg921019 so that tests pass with the latest FastAPI code (0.110.0).
It also adds a test to cover the case with multiple files, and another to ensure the order of parameters in an endpoint definition does not affect the way FastAPI handles the request.

Problem
When declaring an endpoint which accepts a File but also a Form parameter, the File parameter must be declared first or the endpoint would respond with error 422.

Context

YuriiMotov

This comment was marked as outdated.

@thomasleveil
Copy link
Author

Thank you for the feed back. I pushed force with your suggested changes. Let me know if anything else can be improved.

@thomasleveil thomasleveil changed the title Fix #9116 form and file order 🐛 Fix #9116 form and file order Feb 25, 2024
@thomasleveil thomasleveil changed the title 🐛 Fix #9116 form and file order 🐛 Fix #9116 Form and File parameters order should not matter Feb 25, 2024
Copy link
Contributor

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution works.
Tests cover the issue. Tests fail before changes and pass after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants