Skip to content

Fix file upload FormatException for parameterized Content-Type - #9969

Merged
michaelstaib merged 2 commits into
mainfrom
mst/fix-9922
Jun 23, 2026
Merged

michaelstaib merged 2 commits into
mainfrom
mst/fix-9922

Conversation

@michaelstaib

@michaelstaib michaelstaib commented Jun 23, 2026 •

Copy link
Copy Markdown
Member

Fixes #9922

Copilot AI review requested due to automatic review settings June 23, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent a FormatException during multipart file uploads when the provided file Content-Type includes parameters (for example text/plain; charset=utf-8), and adds regression coverage in both Fusion and Transport HTTP client tests.

Changes:

  • Adds a Fusion snapshot test covering forwarding of parameterized file Content-Type values.
  • Extends GraphQLHttpClientTests to include a parameterized Content-Type case.
  • Updates DefaultGraphQLHttpClient multipart file part header handling for Content-Type.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FileUploadTests.cs Adds a Fusion regression test for parameterized file Content-Type.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/FileUploadTests.Upload_Single_File_Should_Forward_Parameterized_ContentType.yaml Adds snapshot asserting the multipart part includes Content-Type: text/plain; charset=utf-8 and the server sees it.
src/HotChocolate/AspNetCore/test/Transport.Http.Tests/GraphQLHttpClientTests.cs Adds theory input for parameterized Content-Type in file upload test coverage.
src/HotChocolate/AspNetCore/src/Transport.Http/DefaultGraphQLHttpClient.cs Changes how multipart file part Content-Type is set (currently via TryAddWithoutValidation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the mst/fix-9922 branch remains at 49%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main ef8b6f3 mst/fix-9922 1b4702c +/-
/home/runner/wo...tionExecutor.cs 70% 56% -14%
/home/runner/wo...ageProcessor.cs 100% 89% -11%
/home/runner/wo...gerMessage.g.cs 19% 11% -8%
/home/runner/wo...Subscription.cs 92% 90% -2%
/home/runner/wo...geDispatcher.cs 77% 75% -2%
/home/runner/wo...boxProcessor.cs 74% 72% -2%
/home/runner/wo...PromiseCache.cs 78% 81% +3%
/home/runner/wo...eiveEndpoint.cs 91% 94% +3%
/home/runner/wo...qlConnection.cs 89% 92% +3%
/home/runner/wo...ntMiddleware.cs 69% 85% +16%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Comment thread src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FileUploadTests.cs Dismissed
@michaelstaib
michaelstaib merged commit 5bb9c0b into main Jun 23, 2026
145 checks passed
@michaelstaib
michaelstaib deleted the mst/fix-9922 branch June 23, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultGraphQLHttpClient: file upload throws FormatException for any parameterized Content-Type

2 participants