1 files changed, 2 insertions, 12 deletions
diff --git a/synapse/http/servlet.py b/synapse/http/servlet.py
index 13fcb408a6..3cabe9d02e 100644
--- a/synapse/http/servlet.py
+++ b/synapse/http/servlet.py
@@ -14,11 +14,9 @@
# limitations under the License.
""" This module contains base REST classes for constructing REST servlets. """
-
+import json
import logging
-from canonicaljson import json
-
from synapse.api.errors import Codes, SynapseError
logger = logging.getLogger(__name__)
@@ -214,16 +212,8 @@ def parse_json_value_from_request(request, allow_empty_body=False):
if not content_bytes and allow_empty_body:
return None
- # Decode to Unicode so that simplejson will return Unicode strings on
- # Python 2
- try:
- content_unicode = content_bytes.decode("utf8")
- except UnicodeDecodeError:
- logger.warning("Unable to decode UTF-8")
- raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
-
try:
- content = json.loads(content_unicode)
+ content = json.loads(content_bytes.decode("utf-8"))
except Exception as e:
logger.warning("Unable to parse JSON: %s", e)
raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
|