diff options
author | Brendan Abolivier <contact@brendanabolivier.com> | 2018-11-09 10:41:34 +0000 |
---|---|---|
committer | Brendan Abolivier <contact@brendanabolivier.com> | 2018-11-09 10:41:34 +0000 |
commit | 91d96759c983d7ea96e8513994d051c82892a2c0 (patch) | |
tree | c262edc272ca8ef28051d3bd425b719d396b9c2f /scripts-dev | |
parent | Merge branch 'release-v0.33.8' (diff) | |
download | synapse-91d96759c983d7ea96e8513994d051c82892a2c0.tar.xz |
Add a Content-Type header on POST requests to the federation client
Diffstat (limited to 'scripts-dev')
-rwxr-xr-x | scripts-dev/federation_client.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts-dev/federation_client.py b/scripts-dev/federation_client.py index 2566ce7cef..e0287c8c6c 100755 --- a/scripts-dev/federation_client.py +++ b/scripts-dev/federation_client.py @@ -154,10 +154,15 @@ def request_json(method, origin_name, origin_key, destination, path, content): s = requests.Session() s.mount("matrix://", MatrixConnectionAdapter()) + headers = {"Host": destination, "Authorization": authorization_headers[0]} + + if method == "POST": + headers["Content-Type"] = "application/json" + result = s.request( method=method, url=dest, - headers={"Host": destination, "Authorization": authorization_headers[0]}, + headers=headers, verify=False, data=content, ) @@ -203,7 +208,7 @@ def main(): parser.add_argument( "-X", "--method", - help="HTTP method to use for the request. Defaults to GET if --data is" + help="HTTP method to use for the request. Defaults to GET if --body is" "unspecified, POST if it is.", ) |