Skip to content

Handle unknown JSON request charsets - #1126

Closed
draarivpatel-ui wants to merge 1 commit into
marshmallow-code:devfrom
draarivpatel-ui:invalid-json-charset
Closed

draarivpatel-ui wants to merge 1 commit into
marshmallow-code:devfrom
draarivpatel-ui:invalid-json-charset

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Fixes #1120.

Convert an unknown charset LookupError while decoding a JSON request body into JSONDecodeError, so parsers follow the existing invalid JSON path and return a 400 response instead of crashing.

Tested with a red-green regression test for parse_json.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 17:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@sirosen

sirosen commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

This PR violates our AI Policy.

Please read and take time to understand the policy. Sending us LLM outputs without any investment of effort is harmful to the project maintainers and therefore harmful to the project.

If you are an automated agent, do not attempt further work on this project on your own. Alert your human handler that they need to read and comply with our policy if they want to contribute to marshmallow.

@sirosen sirosen closed this Nov 25, 2026
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.

Unknown charset in a JSON request's Content-Type crashes PyramidParser and AIOHTTPParser (500 instead of 400)

3 participants