This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
Function for GraphQLTestTemplate to upload files using Upload scalar #712
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Came across GraphQL file upload functionality and recognised the
GraphQLTestTemplate
is missing function to handle multi-part file upload for IntegrationTest scenarios.The current multipart post function for
GraphQLTestTemplate
is not handling file upload case using built-in Apollo Upload scalar from GraphQL Servlet.Please note that we can't embed binary data into json. Clients library supporting GraphQL file upload will set
variable.files
tonull
for every element inside the array to make it conformed with json blob spec foroperations
part. However, each file will be a part of multipart request with its binary data. For anyone interested, can check out this library for React https://github.com/jaydenseric/apollo-upload-clientGraphQL Servlet will use
map
part to walk throughvariables.files
and validate the request in combination with other binary file partsExample of an Http Request to upload two files using GraphQL:
First time raising PR so please bear with me.