diff --git a/lambda-functions/contact_form.py b/lambda-functions/contact_form.py index e106531..8c7e84e 100644 --- a/lambda-functions/contact_form.py +++ b/lambda-functions/contact_form.py @@ -107,6 +107,18 @@ def send_email(event_body): def handle_contact_form(event, context): + if event['requestContext']['http']['method'] != 'POST': + return { + 'statusCode': 400, + 'headers': { + 'Content-Type': 'application/json' + }, + 'body': json.dumps({ + 'success': False, + 'message': 'Unsupported http method' + }) + } + if event['body']: try: body = json.loads(event['body']) diff --git a/lambda-functions/newsletter_sign_up.py b/lambda-functions/newsletter_sign_up.py index 1e73a5e..44f1ea7 100755 --- a/lambda-functions/newsletter_sign_up.py +++ b/lambda-functions/newsletter_sign_up.py @@ -75,6 +75,18 @@ def add_crisp_contact(email): def handle_newsletter_sign_up(event, context): + if event['requestContext']['http']['method'] != 'POST': + return { + 'statusCode': 400, + 'headers': { + 'Content-Type': 'application/json' + }, + 'body': json.dumps({ + 'success': False, + 'message': 'Unsupported http method' + }) + } + if event['body']: try: body = json.loads(event['body'])