Add direct unit tests for HTTPChunkedTransferDecoder#211
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
=======================================
Coverage 92.75% 92.75%
=======================================
Files 70 70
Lines 3645 3645
=======================================
Hits 3381 3381
Misses 264 264 ☔ View full report in Codecov by Sentry. |
Existing chunked-body coverage runs through HTTPDecoder. These tests exercise the decoder directly to pin behavior that integration tests don't cover: that consumption stops at the trailer terminator (so keep-alive pipelining is safe), that nextBuffer(suggested:) honors the suggested cap, that uppercase HEXDIG is accepted per RFC 5234 §2.3, and that chunk-sizes exceeding Int.max are rejected as a framing error.
5ca2c29 to
1d1f0a9
Compare
swhitty
approved these changes
Apr 28, 2026
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
Existing chunked-body coverage runs through
HTTPDecoderintegration tests. This adds four tests that exerciseHTTPChunkedTransferDecoderdirectly, pinning behavior the integration path doesn't cover:nextBuffer(suggested:)honors the suggested cap — a 100-byte chunk requested withsuggested: 16yields only buffers ≤ 16 bytes.FF\r\n…decodes 255 bytes (per RFC 5234 §2.3, ABNF literal strings are case-insensitive).Int.maxrejected — a 20-hex-char value throwsHTTPDecoder.Errorrather than truncating or trapping. Distinct error path from non-hex input (already covered byinvalidChunkSize_ThrowsError).No public-API changes.
Test plan
swift test --filter HTTPChunkedDecodedSequenceTestspasses locally (4/4)