summary refs log tree commit diff
path: root/tests/server.py
diff options
context:
space:
mode:
authorMichael Kaye <1917473+michaelkaye@users.noreply.github.com>2018-09-24 11:20:10 +0100
committerMichael Kaye <1917473+michaelkaye@users.noreply.github.com>2018-09-24 11:20:10 +0100
commit128043072b8220cd1405d12d3bf5afeaffcbce16 (patch)
tree8155578c8327c6869a95c09a752ca922577ab19b /tests/server.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentMerge pull request #3927 from matrix-org/erikj/handle_background_errors (diff)
downloadsynapse-128043072b8220cd1405d12d3bf5afeaffcbce16.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'tests/server.py')
-rw-r--r--tests/server.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/server.py b/tests/server.py

index ccea3baa55..7bee58dff1 100644 --- a/tests/server.py +++ b/tests/server.py
@@ -98,7 +98,7 @@ class FakeSite: return FakeLogger() -def make_request(method, path, content=b"", access_token=None): +def make_request(method, path, content=b"", access_token=None, request=SynapseRequest): """ Make a web request using the given method and path, feed it the content, and return the Request and the Channel underneath. @@ -120,14 +120,16 @@ def make_request(method, path, content=b"", access_token=None): site = FakeSite() channel = FakeChannel() - req = SynapseRequest(site, channel) + req = request(site, channel) req.process = lambda: b"" req.content = BytesIO(content) if access_token: req.requestHeaders.addRawHeader(b"Authorization", b"Bearer " + access_token) - req.requestHeaders.addRawHeader(b"X-Forwarded-For", b"127.0.0.1") + if content: + req.requestHeaders.addRawHeader(b"Content-Type", b"application/json") + req.requestReceived(method, path, b"1.1") return req, channel