Do not use canonicaljson to magically handle decoding bytes from JSON. (#7802)

This commit is contained in:
Patrick Cloke 2020-07-10 14:30:08 -04:00 committed by GitHub
parent d9e47af617
commit 66a4af8d96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 28 deletions

View file

@ -15,13 +15,11 @@
# limitations under the License.
"""Contains exceptions and error codes."""
import json
import logging
from http import HTTPStatus
from typing import Dict, List
from canonicaljson import json
from twisted.web import http
logger = logging.getLogger(__name__)
@ -573,7 +571,7 @@ class HttpResponseException(CodeMessageException):
# try to parse the body as json, to get better errcode/msg, but
# default to M_UNKNOWN with the HTTP status as the error text
try:
j = json.loads(self.response)
j = json.loads(self.response.decode("utf-8"))
except ValueError:
j = {}