mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-25 19:14:11 +03:00
Ensure CSRF cookie is set. Updated dev version
This commit is contained in:
parent
d05407f6a5
commit
317c8ceec4
|
@ -6,7 +6,9 @@ import six
|
|||
from django.http import HttpResponse, HttpResponseNotAllowed
|
||||
from django.http.response import HttpResponseBadRequest
|
||||
from django.shortcuts import render
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import View
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
|
||||
from graphql import Source, execute, parse, validate
|
||||
from graphql.error import format_error as format_graphql_error
|
||||
|
@ -89,6 +91,7 @@ class GraphQLView(View):
|
|||
def get_context(self, request):
|
||||
return request
|
||||
|
||||
@method_decorator(ensure_csrf_cookie)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
try:
|
||||
if request.method.lower() not in ('get', 'post'):
|
||||
|
|
Loading…
Reference in New Issue
Block a user