diff options
author | David Vo <auscompgeek@users.noreply.github.com> | 2020-08-07 22:02:55 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 08:02:55 -0400 |
commit | 4dd27e6d1125df83a754b5e0c2c14aaafc0ce837 (patch) | |
tree | db0e46cd9c3f2f94cedb200d5599a4b4d61651de /synapse/http | |
parent | Revert #7736 (#8039) (diff) | |
download | synapse-4dd27e6d1125df83a754b5e0c2c14aaafc0ce837.tar.xz |
Reduce unnecessary whitespace in JSON. (#7372)
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/server.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index 94ab29974a..ffe6cfa09e 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -25,7 +25,7 @@ from io import BytesIO from typing import Any, Callable, Dict, Tuple, Union import jinja2 -from canonicaljson import encode_canonical_json, encode_pretty_printed_json, json +from canonicaljson import encode_canonical_json, encode_pretty_printed_json from twisted.internet import defer from twisted.python import failure @@ -46,6 +46,7 @@ from synapse.api.errors import ( from synapse.http.site import SynapseRequest from synapse.logging.context import preserve_fn from synapse.logging.opentracing import trace_servlet +from synapse.util import json_encoder from synapse.util.caches import intern_dict logger = logging.getLogger(__name__) @@ -538,7 +539,7 @@ def respond_with_json( # canonicaljson already encodes to bytes json_bytes = encode_canonical_json(json_object) else: - json_bytes = json.dumps(json_object).encode("utf-8") + json_bytes = json_encoder.encode(json_object).encode("utf-8") return respond_with_json_bytes(request, code, json_bytes, send_cors=send_cors) |