Set content type when serving object

Fixes #37
This commit is contained in:
Tyler Kennedy 2022-11-27 16:43:46 -05:00 committed by GitHub
parent 842b458395
commit 68d59b399e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -75,7 +75,10 @@ class Individual(TemplateView):
# If this not a local post, redirect to its canonical URI
if not self.post_obj.local:
return redirect(self.post_obj.object_uri)
return JsonResponse(canonicalise(self.post_obj.to_ap(), include_security=True))
return JsonResponse(
canonicalise(self.post_obj.to_ap(), include_security=True),
content_type="application/activity+json",
)
@method_decorator(identity_required, name="dispatch")

View File

@ -55,7 +55,10 @@ class ViewIdentity(ListView):
# If this not a local actor, redirect to their canonical URI
if not identity.local:
return redirect(identity.actor_uri)
return JsonResponse(canonicalise(identity.to_ap(), include_security=True))
return JsonResponse(
canonicalise(identity.to_ap(), include_security=True),
content_type="application/activity+json",
)
def get_queryset(self):
return (