Skip to content

Commit

Permalink
Corteva fix binary support (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: snowman2 <alansnow21@gmail.com>
  • Loading branch information
kirkhansen and snowman2 committed Jul 9, 2020
1 parent f2520c3 commit e9d8920
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions zappa/handler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import base64
import boto3
import collections
import datetime
import importlib
Expand All @@ -8,10 +7,11 @@
import logging
import os
import sys
import traceback
import tarfile

import traceback
from builtins import str

import boto3
from werkzeug.wrappers import Response

# This file may be copied into a project's root,
Expand Down Expand Up @@ -549,11 +549,9 @@ def handler(self, event, context):
zappa_returndict.setdefault('statusDescription', response.status)

if response.data:
if settings.BINARY_SUPPORT and \
not response.mimetype.startswith("text/") \
and response.mimetype != "application/json":
if settings.BINARY_SUPPORT:
zappa_returndict['body'] = base64.b64encode(response.data).decode('utf-8')
zappa_returndict["isBase64Encoded"] = True
zappa_returndict['isBase64Encoded'] = True
else:
zappa_returndict['body'] = response.get_data(as_text=True)

Expand Down

0 comments on commit e9d8920

Please sign in to comment.