From 30cfe7579253d805c48971aeb9b6b474774d399e Mon Sep 17 00:00:00 2001 From: Tsotne Okrostsvaridze Date: Wed, 10 Dec 2025 23:10:07 +0100 Subject: [PATCH] Fix documentation for JSON error codes Clarify that request.json raises: - 400 Bad Request for invalid JSON content - 415 Unsupported Media Type for wrong Content-Type header Fixes #5825 --- docs/patterns/javascript.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/patterns/javascript.rst b/docs/patterns/javascript.rst index d58a3eb6..ee9b0ec3 100644 --- a/docs/patterns/javascript.rst +++ b/docs/patterns/javascript.rst @@ -244,8 +244,9 @@ Receiving JSON in Views Use the :attr:`~flask.Request.json` property of the :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 -``application/json``, a 400 Bad Request error will be raised. +the body is not valid JSON, a 400 Bad Request error will be raised. If +the ``Content-Type`` header is not set to ``application/json``, a 415 +Unsupported Media Type error will be raised. .. code-block:: python