added check for content-type "application/graphql" in django view

This commit is contained in:
Monte Mishkin 2015-11-12 23:41:01 -08:00
parent 2f0bd7cf7c
commit e48598f4e6

View File

@ -60,6 +60,8 @@ class GraphQLView(View):
query = received_json_data.get('query')
except ValueError:
return self.response_errors(ValueError("Malformed json body in the post data"))
elif content_type == 'application/graphql':
query = request.body.decode()
else:
query = request.POST.get('query') or request.GET.get('query')
return self.execute_query(request, query or '')