warrenday / graphql-network-inspector

A better network inspector for viewing and debugging GraphQL requests.
MIT License
466 stars 46 forks source link

Support for 'multipart/form-data' #101

Closed yicru closed 1 year ago

yicru commented 1 year ago

Is your feature request related to a problem? Please describe. I am experiencing a similar issue to one previously reported #98 , but in this case, it is with 'multipart/form-data' in our GraphQL requests. Our system is attempting to implement FileUpload following the https://github.com/jaydenseric/graphql-multipart-request-spec, but because the request format is not JSON, JSON.parse fails at graphqlHelpers.ts:L211.

Describe the solution you'd like I would like to suggest a similar solution to the one proposed for 'x-www-form-urlencoded' request payloads. We could try to decode the payload as 'multipart/form-data' as a failover if JSON.parse fails.

Additional context I have prepared a demo of the environment where the error occurs at https://gql-file-upload-minimum-example.vercel.app/. I would be glad to contribute towards this change if the maintainers are okay with it.

warrenday commented 1 year ago

Hey @yicru

Looking into this now, thanks for the demo!

warrenday commented 1 year ago

Closing as PR has now been merged. The release will appear this week. https://github.com/warrenday/graphql-network-inspector/pull/102