Skip to content

Commit 3df3f3b

Browse files
authored
Check the request body before trying to turn that into a json (#20)
1 parent 5f39782 commit 3df3f3b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fdk/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def app(context, data=None, loop=None):
4848

4949
if content_type == "application/json":
5050
if isinstance(request_body, str):
51-
body = ujson.loads(request_body)
51+
if len(request_body) > 0:
52+
body = ujson.loads(request_body)
53+
else:
54+
body = {}
5255
else:
5356
body = ujson.load(request_body)
5457
elif content_type in ["text/plain"]:

0 commit comments

Comments
 (0)