1- import json
2- import six
31from functools import partial
42from cgi import parse_header
53
64
75from promise import Promise
86from sanic .response import HTTPResponse
97from sanic .views import HTTPMethodView
10- from sanic .exceptions import SanicException
118
129from graphql .type .schema import GraphQLSchema
1310from graphql .execution .executors .asyncio import AsyncioExecutor
@@ -39,7 +36,6 @@ def __init__(self, **kwargs):
3936 if hasattr (self , key ):
4037 setattr (self , key , value )
4138
42-
4339 self ._enable_async = self ._enable_async and isinstance (kwargs .get ('executor' ), AsyncioExecutor )
4440 assert isinstance (self .schema , GraphQLSchema ), 'A Schema is required to be provided to GraphQLView.'
4541
@@ -135,8 +131,7 @@ def parse_body(self, request):
135131 elif content_type == 'application/json' :
136132 return load_json_body (request .body .decode ('utf8' ))
137133
138- elif content_type == 'application/x-www-form-urlencoded' \
139- or content_type == 'multipart/form-data' :
134+ elif content_type in ('application/x-www-form-urlencoded' , 'multipart/form-data' ):
140135 return request .form
141136
142137 return {}
@@ -147,7 +142,7 @@ def get_mime_type(request):
147142 # information provided by content_type
148143 if 'content-type' not in request .headers :
149144 return None
150-
145+
151146 mimetype , _ = parse_header (request .headers ['content-type' ])
152147 return mimetype
153148
0 commit comments