summary refs log tree commit diff
path: root/tests/rest/client/v1
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-11-16 14:45:22 +0000
committerGitHub <noreply@github.com>2020-11-16 14:45:22 +0000
commitebc405446e6615d6187a2e29cb33f27dd5bd0841 (patch)
tree5903e9c8a8776146e604e99ee2d54119c7974999 /tests/rest/client/v1
parentClarify the usecase for an msisdn delegate (#8734) (diff)
downloadsynapse-ebc405446e6615d6187a2e29cb33f27dd5bd0841.tar.xz
Add a `custom_headers` param to `make_request` (#8760)
Some tests want to set some custom HTTP request headers, so provide a way to do
that before calling requestReceived().
Diffstat (limited to 'tests/rest/client/v1')
-rw-r--r--tests/rest/client/v1/utils.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py
index afaf9f7b85..1b2d0497a6 100644
--- a/tests/rest/client/v1/utils.py
+++ b/tests/rest/client/v1/utils.py
@@ -296,10 +296,12 @@ class RestHelper:
         image_length = len(image_data)
         path = "/_matrix/media/r0/upload?filename=%s" % (filename,)
         request, channel = make_request(
-            self.hs.get_reactor(), "POST", path, content=image_data, access_token=tok
-        )
-        request.requestHeaders.addRawHeader(
-            b"Content-Length", str(image_length).encode("UTF-8")
+            self.hs.get_reactor(),
+            "POST",
+            path,
+            content=image_data,
+            access_token=tok,
+            custom_headers=[(b"Content-Length", str(image_length))],
         )
         request.render(resource)
         self.hs.get_reactor().pump([100])