Skip to content

Conversation

@JasonBalayev
Copy link

@JasonBalayev JasonBalayev commented Dec 27, 2025

Fix error code documentation for request.json

Clarify that a 415 error is raised when Content-Type is incorrect,
while a 400 error is raised when the body is not valid JSON.

This aligns the patterns documentation with the API reference at
https://flask.palletsprojects.com/en/stable/api/#flask.Request.json

Changes Made
Updated docs/patterns/javascript.rst in the "Receiving JSON in Views"
section to correctly distinguish between:

400 Bad Request: Raised when the request body is not valid JSON
415 Unsupported Media Type: Raised when Content-Type header is not
set to application/json

Previously, the documentation incorrectly stated that both scenarios
would raise a 400 error.

fixes #5825

Clarify that a 415 error is raised when Content-Type is incorrect, while a 400 error is raised when the body is not valid JSON.

This aligns the patterns documentation with the API reference.
@davidism davidism closed this Dec 27, 2025
@JasonBalayev
Copy link
Author

Hi David,

I wanted to verify whether the issue addressed in my PR has already been resolved somewhere else? I noticed the PR was closed and would appreciate any context or guidance on the reason.

@davidism
Copy link
Member

There's already an open PR. You're approximately the 10th person not to notice that. You also asked an AI to do it for you, and it slopped out a huge unnecessary description.

@JasonBalayev
Copy link
Author

I just wanted to point that this is my first attempt to a contribution as an aspiring open source developer. My description was for the sole purpose of indicating the changes following the template that was given when creating the PR. I thoroughly reviewed the updated Flask API documentation before submitting my solution with the use of AI.

Additionally, It seems like the issue was already resolved in an open PR (#5827). Closing it would help prevent others like myself from continuing to work on it unintentionally.

@davidism
Copy link
Member

davidism commented Dec 27, 2025

From our contributing guide:

Before starting, check if anyone else is assigned to the issue, or if there are any linked open pull requests. Look through the issue for that information as well as discussion and other linked issues for context.

Also, this was a one sentence change, and that sentence was already written in the issue. There was absolutely no reason to waste resources using an LLM to do a copy paste.

@pallets pallets locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document 415 on the receiving json section

2 participants