Repository navigation
fix(multipart): support content-type parameters and case-insensitivity in MultipartSerializationWriterFactory - #2229
Merged
Vincent Biret (baywet) merged 2 commits intoNov 2, 2026
Conversation
…y in MultipartSerializationWriterFactory
… case-insensitivity
Hardik K (hardikkaurani)
force-pushed
the
fix/multipart-factory-content-type-parameters-and-case
branch
from
November 2, 2026 12:44
04b5d8d to
9e4d21e
Compare
Contributor
Author
|
I've pushed an update addressing the review feedback:
Ready for your review when you have a moment. Thanks! |
Vincent Biret (baywet)
approved these changes
Nov 2, 2026
This was referenced Nov 4, 2026
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
MultipartSerializationWriterFactory.getSerializationWriter()uses strict string equality (contentType.equals(validContentType)) to validate the content type. This causes the factory to reject valid content types that include MIME parameters (e.g.,multipart/form-data; boundary=abc) or use different casing (e.g.,MULTIPART/FORM-DATA).Per RFC 2045 §5.1, content type matching should be case-insensitive and must ignore parameters.
Changes
MultipartSerializationWriterFactory.getSerializationWriter()to strip MIME parameters (split on;, trim) and compare case-insensitively (equalsIgnoreCase).; boundary=abc,; charset=utf-8), uppercase (MULTIPART/FORM-DATA), mixed case (Multipart/Form-Data), and uppercase with parameters.Context
While
SerializationWriterFactoryRegistrystrips parameters before delegating to the factory, the factory can also be used directly (not through the registry), in which case parameterized or case-variant content types would incorrectly throwIllegalArgumentException.This is the same bug pattern already fixed in the TypeScript, Go multipart, Go form, and Go text serialization libraries.
Verification
:components:serialization:multipart:checkpasses