From dbee37898928c89f7311142139f3b09aa658f983 Mon Sep 17 00:00:00 2001 From: Benoit Alessandroni <benoit@happy-dev.fr> Date: Sun, 27 Sep 2020 12:21:30 +0200 Subject: [PATCH] bugfix: adding missing access control allow origin header --- djangoldp_polls/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/djangoldp_polls/views.py b/djangoldp_polls/views.py index 37c7631..750516b 100644 --- a/djangoldp_polls/views.py +++ b/djangoldp_polls/views.py @@ -16,12 +16,14 @@ class CanVoteOnPollViewSet(APIView): def get(self, request, pk): '''returns True if the user can vote, or False if they have already voted''' + headers = {"Access-Control-Allow-Origin" : request.META.get('HTTP_ORIGIN')} + try: poll = Poll.objects.get(pk=pk) can_vote = True if Vote.objects.filter(relatedPoll=poll, user=request.user).exists(): can_vote = False - return Response(can_vote, status=status.HTTP_200_OK) + return Response(can_vote, status=status.HTTP_200_OK, headers=headers) except Poll.DoesNotExist: return Response(data={'error': {'poll': ['Could not find poll with this ID!']}}, -- GitLab