diff --git a/zappa/handler.py b/zappa/handler.py index 41336dc15..45fcb4221 100644 --- a/zappa/handler.py +++ b/zappa/handler.py @@ -592,6 +592,11 @@ def handler(self, event, context): response.data ).decode("utf-8") zappa_returndict["isBase64Encoded"] = True + elif settings.BINARY_SUPPORT and response.headers.get("Content-Encoding", None): + zappa_returndict["body"] = base64.b64encode( + response.data + ).decode("utf-8") + zappa_returndict["isBase64Encoded"] = True else: zappa_returndict["body"] = response.get_data(as_text=True)