This patch removes the "force=True" parameter in the get_json() method. This allows flask to enforce the requirement for a valid Content-Type header and properly formatted JSON payloads. When the request doesn't meet the conditions, flask automatically raises a 400 Bad request. This prevents unexpected errors caused by malformed or non-JSON input. A try-except block has been added to catch and log the error with a clear message. Unit tests have been added to verify both valid and invalid cases. Signed-off-by: Queensly Kyerewaa Acheampongmaa <qacheampong@gmail.com> Change-Id: I0d5b18a92939d26cba565c6226d5713e9e7735b6
37 KiB
Executable File
37 KiB
Executable File