-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
The dotnet-anvil client currently doesn't support multipart file uploads for GraphQL mutations. When users attempt to upload files using the standard base64 format (matching our Node.js client API), they receive an IOException: Unable to write data to the transport connection: Broken pipe error.
Example
A user attempts to create a cast with a PDF file:
var query = @"
mutation createCast(
$title: String,
$file: Upload!,
$isTemplate: Boolean,
$detectFields: Boolean
) {
createCast (
title: $title,
file: $file,
isTemplate: $isTemplate,
detectFields: $detectFields
) {
eid
name
title
isTemplate
}
}
";
var variables = new {
title = "Testing from the code",
file = new {
data = "Base64 encoded file...",
mimetype = "application/pdf",
filename = "test-code"
},
isTemplate = true
};
var response = await client.SendQuery(query, variables);
The client sends this as JSON with embedded base64 data, but Anvil's GraphQL endpoint expects multipart/form-data format for file uploads per the GraphQL multipart request spec.
Proposed Solution
Update the SendQuery method in the dotnet-anvil client to:
- Detect when mutations contain Upload type parameters
- Transform
base64file objects toFileStreamVariableinstances (required by GraphQL.Client library) - Let
GraphQL.Clienthandle themultipart/form-dataformatting.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels