From 5195b2c91b303a15251e0a7800cb5a109287d7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Yasinhan=20Ya=C5=9Far?= Date: Mon, 31 Jul 2023 17:40:23 +0300 Subject: [PATCH] request object instead of string request object instead of string as body inside json data --- flask_lambda.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flask_lambda.py b/flask_lambda.py index 7ab97af..84d3e03 100644 --- a/flask_lambda.py +++ b/flask_lambda.py @@ -15,6 +15,7 @@ # under the License. import sys +import json try: from urllib import urlencode @@ -69,7 +70,7 @@ def make_environ(event): ) environ['wsgi.url_scheme'] = environ['HTTP_X_FORWARDED_PROTO'] - environ['wsgi.input'] = StringIO(event['body'] or '') + environ['wsgi.input'] = StringIO(json.dumps(event['body']) or '') environ['wsgi.version'] = (1, 0) environ['wsgi.errors'] = sys.stderr environ['wsgi.multithread'] = False @@ -109,5 +110,5 @@ def __call__(self, event, context): return { 'statusCode': response.status, 'headers': response.response_headers, - 'body': body - } + 'body': json.loads(body) + } \ No newline at end of file