Skip to content

Commit

Permalink
Add a Content-Type header on POST requests to the federation client
Browse files Browse the repository at this point in the history
  • Loading branch information
babolivier committed Nov 9, 2018
1 parent 907e6da commit 91d9675
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts-dev/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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.",
)

Expand Down

0 comments on commit 91d9675

Please sign in to comment.