Files
sushy-tools/sushy_tools/emulator/main.py
Queensly Acheampongmaa 4d7850318e Validate JSON content type before parsing manager PATCH requests
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
2025-07-19 14:03:10 +00:00

37 KiB
Executable File