docs: clarify 415 vs 400 errors for request.json

This commit is contained in:
Aditya 2025-10-09 12:31:01 +05:30 committed by David Lord
parent 25642fd1fd
commit d52f0228d9
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926

View file

@ -244,8 +244,9 @@ Receiving JSON in Views
Use the :attr:`~flask.Request.json` property of the Use the :attr:`~flask.Request.json` property of the
:data:`~flask.request` object to decode the request's body as JSON. If :data:`~flask.request` object to decode the request's body as JSON. If
the body is not valid JSON, or the ``Content-Type`` header is not set to the body is not valid JSON, a 400 Bad Request error will be raised. If
``application/json``, a 400 Bad Request error will be raised. the ``Content-Type`` header is not set to ``application/json``, a 415
Unsupported Media Type error will be raised.
.. code-block:: python .. code-block:: python