Skip to content

Commit bf4d9d9

Browse files
committed
defensive coding
safer method of extracting response info
1 parent 180f5c2 commit bf4d9d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lambda_gateway/request_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ def invoke(self, httpMethod):
9494
res = self.proxy.invoke(event)
9595

9696
# Parse response
97-
status = res.get('statusCode', 500)
98-
headers = res.get('headers', {})
99-
body = res.get('body', '')
97+
status = res.get('statusCode') or 500
98+
headers = res.get('headers') or {}
99+
body = res.get('body') or ''
100100

101101
# Send response
102102
self.send_response(status)

0 commit comments

Comments
 (0)