mirror of
https://github.com/Sea-Haven-Industries/meal-order-manager.git
synced 2026-10-07 16:18:54 +00:00
fix: address review comments
This commit is contained in:
parent
be0cfce943
commit
308f46eafd
2 changed files with 9 additions and 4 deletions
|
|
@ -237,6 +237,9 @@ def handle_publish_menu(event):
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
return response(400, {"error": "Invalid JSON"})
|
return response(400, {"error": "Invalid JSON"})
|
||||||
|
|
||||||
|
if not isinstance(body, dict):
|
||||||
|
return response(400, {"error": "Request body must be a JSON object"})
|
||||||
|
|
||||||
meals = body.get("meals")
|
meals = body.get("meals")
|
||||||
if not isinstance(meals, list) or not meals:
|
if not isinstance(meals, list) or not meals:
|
||||||
return response(400, {"error": "At least one meal is required"})
|
return response(400, {"error": "At least one meal is required"})
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ def signed_request(
|
||||||
body: dict | None = None,
|
body: dict | None = None,
|
||||||
region: str = "us-east-1",
|
region: str = "us-east-1",
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
if not api_url.startswith(("http://", "https://")):
|
||||||
|
raise ValueError(f"api_url must use http(s) scheme: {api_url!r}")
|
||||||
data = json.dumps(body).encode() if body is not None else None
|
data = json.dumps(body).encode() if body is not None else None
|
||||||
headers = {"Content-Type": "application/json"} if data is not None else {}
|
headers = {"Content-Type": "application/json"} if data is not None else {}
|
||||||
request = AWSRequest(
|
request = AWSRequest(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue