Emit multipart parts with empty bodies in PartGenerator - #37202
Open
shaggyinsomniac wants to merge 1 commit into
Open
Emit multipart parts with empty bodies in PartGenerator#37202shaggyinsomniac wants to merge 1 commit into
shaggyinsomniac wants to merge 1 commit into
Conversation
Member
|
Please sign the DCO |
Parts were emitted only from PartListener.onBody(buffer, last=true), so a part with an empty body (for example a blank form field, or a trailing empty part) was silently dropped from the resulting MultiValueMap, and was indistinguishable from an absent field. This carries over the fix from the reactive DefaultPartHttpMessageReader (spring-framework#30953): State gains an onComplete() callback that emits the part, also when it has an empty body. It is invoked when a new part begins, and when parsing completes for the final part. Signed-off-by: Sagar Chanchal <Sagarr2112@gmail.com>
shaggyinsomniac
force-pushed
the
multipart-empty-parts
branch
from
August 27, 2026 13:11
75d3edd to
bcb268c
Compare
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.
Fixes #37200
Description
Parts were emitted only from
PartListener.onBody(buffer, last=true), so a part with an empty body (for example a blank form field, or a trailing empty part) was silently dropped from the resultingMultiValueMap, and was indistinguishable from an absent field.This carries over the fix from the reactive
DefaultPartHttpMessageReader(#30953):Stategains anonComplete()callback that emits the part — also when it has an empty body. It is invoked when a new part begins (previous part completes without a final body chunk) and when parsing completes (final part).Emission is guarded per state so a part completed via
onBody(last=true)is not emitted twice.Test coverage
readMultipartEmptyPart()— empty form field followed by a non-empty onereadMultipartEmptyLastPart()— non-empty field followed by a trailing empty partmain(part missing from the result) and pass with this change; the full:spring-web:testsuite (3,919 tests) passes