Skip empty HTTPBody chunks in the URLSession stream bridge - #96
Open
Hashim1999164 wants to merge 1 commit into
Open
Skip empty HTTPBody chunks in the URLSession stream bridge#96Hashim1999164 wants to merge 1 commit into
Hashim1999164 wants to merge 1 commit into
Conversation
guoye-zhang
approved these changes
Aug 13, 2026
Contributor
|
@czechboy0 Based on the discussion in #85, should we work around the assert here or make it impossible to vend an empty chunk from the runtime? |
Contributor
|
We need to make it legal to send an empty chunk, but exactly how that should be done here I'd defer to @simonjbeaumont and you about. We definitely can't add a new requirement into Runtime, as it could break some adopters who use empty chunks already with other transports. |
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 #85
An empty text/plain request body vends a zero length chunk. The output stream bridge then tried to write that chunk and hit a precondition. Maintainers agreed the transport should send an empty body.
Empty chunks are now skipped so the stream closes with a zero length body instead of crashing.
Test plan
Added testHTTPBodyOutputStreamEmptyChunkDoesNotCrash covering a single empty chunk. Built the OpenAPIURLSession product. Full XCTest suite needs Xcode.