0

I'm trying to debug a complex problem I have with csrf tokens. How can I print out the request headers before the view answers with a 403 - CSRF Failed: CSRF token missing or incorrect? My view is answering with that 403 error, I'm pretty sure I am sending the token in the ajax request. So, I need to see what headers is django receiving. Where can I get them? which middleware has the task of checking the csrf token?

I'm not sure how relevant is this, but I'm using Django Rest Framework and the view that receives the request looks like this:

class CreateCartItem(generics.CreateAPIView):

    permission_classes = (IsAuthenticated,)
    renderer_classes = (JSONRenderer,)
    serializer_class = CartItemSerializer
  • This is not a duplicate of any question. It is pretty clear to me, all that I need is a way to find the headers that Django is receiving. How can I achieve that?
Community
  • 1
  • 1
Alejandro Veintimilla
  • 10,743
  • 23
  • 91
  • 180

0 Answers0