docs: clarify JSON parsing error conditions in Flask views
This commit is contained in:
parent
adf363679d
commit
872f1ba54e
1 changed files with 3 additions and 2 deletions
|
|
@ -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, or if parsing fails for any reason (including
|
||||||
``application/json``, a 400 Bad Request error will be raised.
|
a missing or incorrect ``Content-Type`` header), a 400 Bad Request error
|
||||||
|
will be raised.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue