Return HTTP 400 if missing query parameters

This commit is contained in:
Dylan 2022-05-30 01:25:53 +01:00
parent 891db049af
commit ffcde09b97

View file

@ -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"):