Repository navigation
Fix file upload FormatException for parameterized Content-Type #9969
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
...pshots__/FileUploadTests.Upload_Single_File_Should_Forward_Parameterized_ContentType.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| title: Upload_Single_File_Should_Forward_Parameterized_ContentType | ||
| request: | ||
| contentType: multipart/form-data; boundary="f56524ab-5626-4955-b296-234a097b44f6" | ||
| body: | | ||
| --f56524ab-5626-4955-b296-234a097b44f6 | ||
| Content-Type: application/json; charset=utf-8 | ||
| Content-Disposition: form-data; name=operations | ||
|
|
||
| {"query":"query ($file: Upload!) {\n singleUpload(file: $file) {\n fileName\n contentType\n content\n }\n}","variables":{"file":null}} | ||
| --f56524ab-5626-4955-b296-234a097b44f6 | ||
| Content-Type: application/json; charset=utf-8 | ||
| Content-Disposition: form-data; name=map | ||
|
|
||
| {"0":["variables.file"]} | ||
| --f56524ab-5626-4955-b296-234a097b44f6 | ||
| Content-Type: text/plain; charset=utf-8 | ||
| Content-Disposition: form-data; name=0; filename=test.txt; filename*=utf-8''test.txt | ||
|
|
||
| abc | ||
| --f56524ab-5626-4955-b296-234a097b44f6-- | ||
| response: | ||
| body: | | ||
| { | ||
| "data": { | ||
| "singleUpload": { | ||
| "fileName": "test.txt", | ||
| "contentType": "text/plain; charset=utf-8", | ||
| "content": "abc" | ||
| } | ||
| } | ||
| } | ||
| sourceSchemas: | ||
| - name: A | ||
| schema: | | ||
| schema { | ||
| query: Query | ||
| } | ||
|
|
||
| type Query { | ||
| singleUpload(file: Upload!): FileUploadResult! | ||
| nullableUpload(file: Upload): FileUploadResult | ||
| singleUploadWithInput(input: FileInput!): FileUploadResult! | ||
| multiUpload(files: [Upload!]!): [FileUploadResult!]! | ||
| multiUploadWithInput(input: FilesInput!): [FileUploadResult!]! | ||
| } | ||
|
|
||
| type FileUploadResult { | ||
| fileName: String! | ||
| contentType: String | ||
| content: String! | ||
| } | ||
|
|
||
| input FileInput { | ||
| file: Upload! | ||
| } | ||
|
|
||
| input FilesInput { | ||
| files: [Upload!]! | ||
| } | ||
|
|
||
| "Defines the possible serialization types for GraphQL scalar values." | ||
| enum ScalarSerializationType { | ||
| "The scalar serializes to a string value." | ||
| STRING | ||
| "The scalar serializes to a boolean value." | ||
| BOOLEAN | ||
| "The scalar serializes to an integer value." | ||
| INT | ||
| "The scalar serializes to a floating-point value." | ||
| FLOAT | ||
| "The scalar serializes to an object value." | ||
| OBJECT | ||
| "The scalar serializes to a list value." | ||
| LIST | ||
| } | ||
|
|
||
| "The `Upload` scalar type represents a file upload." | ||
| scalar Upload @serializeAs(type: STRING) | ||
|
|
||
| directive @serializeAs( | ||
| "The primitive type a scalar is serialized to." | ||
| type: [ScalarSerializationType!]! | ||
| "The ECMA-262 regex pattern that the serialized scalar value conforms to." | ||
| pattern: String | ||
| ) on SCALAR | ||
| interactions: | ||
| - request: | ||
| accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 | ||
| contentType: multipart/form-data; boundary="f56524ab-5626-4955-b296-234a097b44f6" | ||
| body: | | ||
| --f56524ab-5626-4955-b296-234a097b44f6 | ||
| Content-Type: application/json; charset=utf-8 | ||
| Content-Disposition: form-data; name=operations | ||
|
|
||
| {"query":"query Op_6e1beb14_1($file: Upload!) {\n singleUpload(file: $file) {\n fileName\n contentType\n content\n }\n}","variables":{"file":null}} | ||
| --f56524ab-5626-4955-b296-234a097b44f6 | ||
| Content-Type: application/json; charset=utf-8 | ||
| Content-Disposition: form-data; name=map | ||
|
|
||
| {"0":["variables.file"]} | ||
| --f56524ab-5626-4955-b296-234a097b44f6 | ||
| Content-Type: text/plain; charset=utf-8 | ||
| Content-Disposition: form-data; name=0; filename=test.txt; filename*=utf-8''test.txt | ||
|
|
||
| abc | ||
| --f56524ab-5626-4955-b296-234a097b44f6-- | ||
| response: | ||
| results: | ||
| - | | ||
| { | ||
| "data": { | ||
| "singleUpload": { | ||
| "fileName": "test.txt", | ||
| "contentType": "text/plain; charset=utf-8", | ||
| "content": "abc" | ||
| } | ||
| } | ||
| } | ||
| operationPlan: | ||
| operation: | ||
| - document: | | ||
| query($file: Upload!) { | ||
| singleUpload(file: $file) { | ||
| fileName | ||
| contentType | ||
| content | ||
| } | ||
| } | ||
| hash: 6e1beb142822946e961b9f062df288a0 | ||
| searchSpace: 1 | ||
| expandedNodes: 1 | ||
| nodes: | ||
| - id: 1 | ||
| type: Operation | ||
| schema: A | ||
| operation: | | ||
| query Op_6e1beb14_1($file: Upload!) { | ||
| singleUpload(file: $file) { | ||
| fileName | ||
| contentType | ||
| content | ||
| } | ||
| } | ||
| forwardedVariables: | ||
| - file | ||
| requiresFileUpload: true |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.