docs: clarify 415 vs 400 errors for request.json

Distinguish between 415 Unsupported Media Type (wrong Content-Type)
and 400 Bad Request (invalid JSON body) to align with API documentation.

Fixes #58254
This commit is contained in:
Aditya 2025-10-09 12:33:43 +05:30 committed by David Lord
parent d52f0228d9
commit 3962683c5b
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926

View file

@ -136,7 +136,8 @@ In general, prefer sending request data as form data, as would be used
when submitting an HTML form. JSON can represent more complex data, but
unless you need that it's better to stick with the simpler format. When
sending JSON data, the ``Content-Type: application/json`` header must be
sent as well, otherwise Flask will return a 400 error.
sent as well, otherwise Flask will return a 415 Unsupported Media Type
error.
.. code-block:: javascript