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

[WIP] Allow using multipart/form-data to upload files with graphql #615

Closed
wants to merge 1 commit into from

Conversation

jareks
Copy link

@jareks jareks commented Aug 24, 2019

Currently sending multipart/form-data to Starlette's GraphQL results in 415 "unsupported media type" error.
This PR adds basic support for multipart/form-data which can be used for uploading files with GraphQL.

I am not sure if this is good way to implement this functionality and would greatly appreciate any comments. For what it's worth, this solution works fine in my pet project.

Regarding tests, I am happy to look into them once I get confirmation this PR goes in right direction.

@tomchristie
Copy link
Member

Before proceeding with this - does the GraphQL spec support multipart uploads.
Could you link to any related or relevant docs so that I've got something to check the implementation against. Thanks! 😃

@jareks
Copy link
Author

jareks commented Aug 28, 2019

Here is the relay modern example is was starting with: facebook/relay#1844 (comment)
Please note this uses uploadables parameter of fetchQuery as described in Relay's network doc: https://relay.dev/docs/en/network-layer

I see second option: https://github.com/jaydenseric/graphql-multipart-request-spec
This spec seems to be a bit more complicated and I didn't need extra mapping functionality.

In summary: this PR adds very simple method to allow uploading files. Let me know if you think this is useful :)

@anilwarbhe
Copy link

Currently sending multipart/form-data to Starlette's GraphQL results in 415 "unsupported media type" error.
This PR adds basic support for multipart/form-data which can be used for uploading files with GraphQL.

I am not sure if this is good way to implement this functionality and would greatly appreciate any comments. For what it's worth, this solution works fine in my pet project.

Regarding tests, I am happy to look into them once I get confirmation this PR goes in right direction.

I am getting the same error 415. Need help on how to achieve file upload in starlette graphql.

Regards

@JayH5
Copy link
Member

JayH5 commented Feb 5, 2021

Thank you for creating this pull request. We have decided to deprecate GraphQL support within Starlette itself so I am going to close this pull request. See #619.

@JayH5 JayH5 closed this Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants