Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion zappa/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,12 @@ def handler(self, event, context):
zappa_returndict.setdefault('statusDescription', response.status)

if response.data:
if settings.BINARY_SUPPORT and \
if settings.BINARY_SUPPORT and response.headers.get("Content-Encoding"):
# We could have a text response that's gzip
# encoded. Therefore, we base-64 encode it.
zappa_returndict['body'] = base64.b64encode(response.data).decode('utf-8')
zappa_returndict["isBase64Encoded"] = True
elif settings.BINARY_SUPPORT and \
not response.mimetype.startswith("text/") \
and response.mimetype != "application/json":
zappa_returndict['body'] = base64.b64encode(response.data).decode('utf-8')
Expand Down