mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-07 16:24:59 -04:00
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().
This commit is contained in:
parent
f1de4bb58b
commit
ebc405446e
4 changed files with 24 additions and 11 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue