Relax accept header for gup.pe
This commit is contained in:
parent
78d2283458
commit
4635874c12
|
@ -24,10 +24,13 @@ class JsonViewer(FormView):
|
|||
|
||||
def form_valid(self, form):
|
||||
raw_result = ""
|
||||
uri = form.cleaned_data["uri"]
|
||||
if "://" not in uri:
|
||||
uri = "https://" + uri
|
||||
try:
|
||||
response = async_to_sync(SystemActor().signed_request)(
|
||||
method="get",
|
||||
uri=form.cleaned_data["uri"],
|
||||
uri=uri,
|
||||
)
|
||||
except httpx.RequestError:
|
||||
result = "Request Error"
|
||||
|
|
|
@ -183,6 +183,8 @@ class HttpSignature:
|
|||
Performs an async request to the given path, with a document, signed
|
||||
as an identity.
|
||||
"""
|
||||
if "://" not in uri:
|
||||
raise ValueError("URI does not contain a scheme")
|
||||
# Create the core header field set
|
||||
uri_parts = urlparse(uri)
|
||||
date_string = http_date()
|
||||
|
@ -200,9 +202,7 @@ class HttpSignature:
|
|||
body_bytes = b""
|
||||
# GET requests get implicit accept headers added
|
||||
if method == "get":
|
||||
headers[
|
||||
"Accept"
|
||||
] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
headers["Accept"] = "application/ld+json"
|
||||
# Sign the headers
|
||||
signed_string = "\n".join(
|
||||
f"{name.lower()}: {value}" for name, value in headers.items()
|
||||
|
|
Loading…
Reference in New Issue