Skip to content

Commit

Permalink
Fixed safwanrahman#11: Request body in save_info view is bytes object (
Browse files Browse the repository at this point in the history
…safwanrahman#17)

Fixed safwanrahman#11: Request body in save_info view is bytes object (support for Python 3).
  • Loading branch information
arogachev authored and safwanrahman committed Oct 7, 2016
1 parent 1fc940e commit 63c1a63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webpush/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def save_info(request):
# Parse the json object from post data. return 400 if the json encoding is wrong
try:
post_data = json.loads(request.body)
post_data = json.loads(request.body.decode('utf-8'))
except ValueError:
return HttpResponse(status=400)

Expand Down Expand Up @@ -69,4 +69,4 @@ def process_subscription_data(post_data):
subscription_data.update(keys)
# Insert the browser name
subscription_data["browser"] = post_data.pop("browser")
return subscription_data
return subscription_data

0 comments on commit 63c1a63

Please sign in to comment.