From 47bad9ecc91e665410fc7fbbc79a6ae0d116dd81 Mon Sep 17 00:00:00 2001 From: Jakob Bowyer Date: Thu, 2 Mar 2017 11:33:21 +0000 Subject: [PATCH] Wrapped bytes acceptance on python 3.5 --- sanic/request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sanic/request.py b/sanic/request.py index bca0cf27..d555b95f 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -7,7 +7,10 @@ from urllib.parse import parse_qs try: from ujson import loads as json_loads except ImportError: - from json import loads as json_loads + from json import loads as _json_loads + def json_loads(i): + i = i.decode() if isinstance(i, bytes) else i + return _json_loads(i) from sanic.exceptions import InvalidUsage from sanic.log import log