From ffcde09b976dd85630da73cb4c804b86c63fb760 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 30 May 2022 01:25:53 +0100 Subject: [PATCH] Return HTTP 400 if missing query parameters --- combineImg/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/combineImg/__init__.py b/combineImg/__init__.py index a341f16..f85a3d0 100644 --- a/combineImg/__init__.py +++ b/combineImg/__init__.py @@ -116,6 +116,11 @@ def genImageFromURL(urlArray): return finalImg def lambda_handler(event, context): + if ("queryStringParameters" not in event): + return { + "statusCode": 400, + "body": "Invalid request." + } images = event["queryStringParameters"].get("imgs","").split(",") for img in images: if not img.startswith("https://pbs.twimg.com"):