Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support version 3 for graphene #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions graphene_file_upload/flask/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Apply multipart request spec to flask"""
from flask import request
from flask_graphql import GraphQLView
from graphql_server.flask import GraphQLView
from graphql_server import load_json_body

from ..utils import place_files_in_operations
Expand All @@ -12,12 +12,8 @@ class FileUploadGraphQLView(GraphQLView):
def parse_body(self):
"""Handle multipart request spec for multipart/form-data"""
content_type = request.mimetype
if content_type == 'multipart/form-data':
operations = load_json_body(request.form.get('operations', '{}'))
files_map = load_json_body(request.form.get('map', '{}'))
return place_files_in_operations(
operations,
files_map,
request.files
)
if content_type == "multipart/form-data":
operations = load_json_body(request.form.get("operations", "{}"))
files_map = load_json_body(request.form.get("map", "{}"))
return place_files_in_operations(operations, files_map, request.files)
return super(FileUploadGraphQLView, self).parse_body()