Validate config JSON body shape

This commit is contained in:
Dymas
2026-05-16 11:48:01 +02:00
parent 839154aa5c
commit 68fdc99bbd
6 changed files with 17 additions and 4 deletions
+7
View File
@@ -1103,6 +1103,13 @@ class HandlerRouteTests(unittest.TestCase):
APP.Handler.body_json(handler)
self.assertIn("utf-8", str(ctx.exception).lower())
def test_config_post_rejects_non_object_json_body(self):
body = b"[]"
handler = DummyHandler("/api/config", body=body, content_length=len(body))
APP.Handler.do_POST(handler)
self.assertEqual(handler.error_status, HTTPStatus.BAD_REQUEST)
self.assertIn("json object", handler.error_message.lower())
def test_remove_post_missing_show_id_returns_bad_request(self):
handler = DummyHandler("/api/watchlist/remove", body=b"{}", content_length=2)
APP.Handler.do_POST(handler)