Fediverse: Use default headers

Some instances behind Cloudflare block requests without a User-Agent
header.
This commit is contained in:
Valentin Lorentz 2023-01-28 13:00:14 +01:00
parent 3f5a18e8d0
commit 922b00c8c3

View File

@ -229,7 +229,9 @@ def get_public_key_pem():
def signed_request(url, headers=None, data=None):
method = "get" if data is None else "post"
instance_actor_url = get_instance_actor_url()
headers = gen.InsensitivePreservingDict(headers or {})
headers = gen.InsensitivePreservingDict(
{**web.defaultHeaders, **(headers or {})}
)
if "Date" not in headers:
headers["Date"] = email.utils.formatdate(usegmt=True)