File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,13 @@ def process_body(self, body_wrapper):
132132 body = body_wrapper .get ('body' )
133133 transfer_encoding = 'json'
134134 except Exception as e :
135- body = base64 .b64encode (body_wrapper ['body' ].encode ("utf-8" ))
136- return str (encodedBytes , "utf-8" ), 'json'
135+ body = base64 .b64encode (str (body_wrapper ['body' ]).encode ("utf-8" ))
136+ if isinstance (body , str ):
137+ return str (body ).encode ("utf-8" ), 'base64'
138+ elif isinstance (body , (bytes , bytearray )):
139+ return str (body , "utf-8" ), 'base64'
140+ else :
141+ return str (body ), 'base64'
137142 return body , transfer_encoding
138143
139144 def before (self , event , context ):
Original file line number Diff line number Diff line change 2828 # Versions should comply with PEP440. For a discussion on single-sourcing
2929 # the version across setup.py and the project code, see
3030 # https://packaging.python.org/en/latest/single_source_version.html
31- version = '1.0.5 ' ,
31+ version = '1.0.6 ' ,
3232
3333 description = 'Moesif Middleware to automatically log API calls from AWS Lambda functions' ,
3434 long_description = long_description ,
You can’t perform that action at this time.
0 commit comments