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

Use 422 Unprocessable Entity for Form deserialization errors, except GET and HEAD requests #1683

Merged
merged 8 commits into from
Feb 17, 2023

Conversation

davidpdrsn
Copy link
Member

@davidpdrsn davidpdrsn commented Jan 7, 2023

For GET and HEAD requests Form should use 400 Bad Request (422 is only for request bodies).

Fixes #1680

TODO

  • Changelog
  • Update docs for Form to mention that it handles both query and body params.

Deserialization errors for `Form` previously always used `400 Bad
Request`. However that should apply for `GET` requests. `POST` etc.
should use `422`.

Fixes #1680
@davidpdrsn davidpdrsn changed the title Use 422 Unprocessable Entity for form deserialization errors Use 422 Unprocessable Entity for Form deserialization errors, except GET requests Jan 7, 2023
@davidpdrsn davidpdrsn changed the title Use 422 Unprocessable Entity for Form deserialization errors, except GET requests Use 422 Unprocessable Entity for Form deserialization errors, except GET and HEAD requests Jan 13, 2023
@davidpdrsn davidpdrsn marked this pull request as ready for review January 13, 2023 09:29
@@ -104,6 +112,7 @@ composite_rejection! {
pub enum FormRejection {
InvalidFormContentType,
FailedToDeserializeForm,
Copy link
Member

Choose a reason for hiding this comment

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

This should have a Query prefix then in the next breaking-change release, I guess?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I think so!

@davidpdrsn davidpdrsn mentioned this pull request Feb 17, 2023
11 tasks
@davidpdrsn davidpdrsn merged commit cd86f7e into main Feb 17, 2023
@davidpdrsn davidpdrsn deleted the fix-form-status-code branch February 17, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form extractor should return 422 Unprocessable Entity for deserialization errors
2 participants