mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 09:35:45 +03:00
Add a Content-Type header on POST requests to the federation client
This commit is contained in:
parent
907e6da5be
commit
91d96759c9
1 changed files with 7 additions and 2 deletions
|
@ -154,10 +154,15 @@ def request_json(method, origin_name, origin_key, destination, path, content):
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
s.mount("matrix://", MatrixConnectionAdapter())
|
s.mount("matrix://", MatrixConnectionAdapter())
|
||||||
|
|
||||||
|
headers = {"Host": destination, "Authorization": authorization_headers[0]}
|
||||||
|
|
||||||
|
if method == "POST":
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
result = s.request(
|
result = s.request(
|
||||||
method=method,
|
method=method,
|
||||||
url=dest,
|
url=dest,
|
||||||
headers={"Host": destination, "Authorization": authorization_headers[0]},
|
headers=headers,
|
||||||
verify=False,
|
verify=False,
|
||||||
data=content,
|
data=content,
|
||||||
)
|
)
|
||||||
|
@ -203,7 +208,7 @@ def main():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-X",
|
"-X",
|
||||||
"--method",
|
"--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.",
|
"unspecified, POST if it is.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue