summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-11-13 23:48:25 +0000
committerRichard van der Hoff <richard@matrix.org>2020-11-15 23:09:03 +0000
commit70c0d47989b7794766ea957369c77d99664429c5 (patch)
tree65711c822c8c80b84944a2994e2a7b001f7ab717
parentpass a Site into make_request (diff)
downloadsynapse-70c0d47989b7794766ea957369c77d99664429c5.tar.xz
fix dict handling for make_request()
-rw-r--r--tests/server.py2
-rw-r--r--tests/unittest.py3
2 files changed, 2 insertions, 3 deletions
diff --git a/tests/server.py b/tests/server.py
index b9ccde4962..a74fb3fc67 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -193,6 +193,8 @@ def make_request(
     if not path.startswith(b"/"):
         path = b"/" + path
 
+    if isinstance(content, dict):
+        content = json.dumps(content).encode("utf8")
     if isinstance(content, str):
         content = content.encode("utf8")
 
diff --git a/tests/unittest.py b/tests/unittest.py
index 8c7979a7c0..3e656b7b12 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -429,9 +429,6 @@ class HomeserverTestCase(TestCase):
         Returns:
             Tuple[synapse.http.site.SynapseRequest, channel]
         """
-        if isinstance(content, dict):
-            content = json.dumps(content).encode("utf8")
-
         return make_request(
             self.reactor,
             self.site,