Skip to content

Commit

Permalink
bytesIO fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arbee committed Jan 22, 2024
1 parent 12562da commit 17e0e62
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions flask_lambda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@

from flask import Flask

try:
from cStringIO import StringIO
except ImportError:
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import io

from flask import Request
from flask_lambda.util import get_nested
Expand Down Expand Up @@ -72,7 +66,7 @@ def make_environ(event, context):
)

environ['wsgi.url_scheme'] = environ.get('HTTP_X_FORWARDED_PROTO', '')
environ['wsgi.input'] = StringIO(event['body'] or '')
environ['wsgi.input'] = io.BytesIO((event['body'] or '').encode())
environ['wsgi.version'] = (1, 0)
environ['wsgi.errors'] = sys.stderr
environ['wsgi.multithread'] = False
Expand Down

0 comments on commit 17e0e62

Please sign in to comment.