From 3962683c5bd9477182d980a1081f5effb46c8ed2 Mon Sep 17 00:00:00 2001 From: Aditya Date: Thu, 9 Oct 2025 12:33:43 +0530 Subject: [PATCH] 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 --- docs/patterns/javascript.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/patterns/javascript.rst b/docs/patterns/javascript.rst index ee9b0ec3..b97ffc6d 100644 --- a/docs/patterns/javascript.rst +++ b/docs/patterns/javascript.rst @@ -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