How can I check csrf-cookie while processing GET request?

373 views Asked by At

For some architectural reasons I have to use csrf-token verification with GET requests. First I've tried top user @csrf_protect decorator from Django. so, this code:

class MyView():

    @method_decorator(csrf_protect)
    def get(self):
    ...

But this approach causes an error:

TypeError at /home/
_wrapped_view() takes at least 1 argument (0 given) 

in /site-packages/django/utils/decorators.py in _wrapper, line 25

Also as far as I can see, it can work only with POST requests. So how can I check csrf cookie when handling GET method?

0

There are 0 answers