decode the utf8 encoded body to a unicode string before passing it on

This commit is contained in:
Thomas Steen Rasmussen 2017-04-08 11:28:08 +02:00
parent 0d5d6dc31e
commit 7506326cd7

View file

@ -603,7 +603,7 @@ class CoinifyCallbackView(SingleObjectMixin, View):
# attempt to parse json
try:
parsed = json.loads(request.body)
parsed = json.loads(request.body.decode('utf-8'))
except Exception as E:
parsed = ''
@ -622,7 +622,7 @@ class CoinifyCallbackView(SingleObjectMixin, View):
return HttpResponseBadRequest('unable to parse json')
# attemt to validate the callbackc
if sdk.validate_callback(request.body, signature):
if sdk.validate_callback(request.body.decode('utf-8'), signature):
# mark callback as valid in db
callbackobject.valid=True
callbackobject.save()