Repository navigation
fix: validate all repeated request header values - #349
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #349 +/- ##
=======================================
Coverage 98.76% 98.76%
=======================================
Files 95 95
Lines 12428 12430 +2
=======================================
+ Hits 12274 12276 +2
Misses 129 129
Partials 25 25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
daveshanley
marked this pull request as ready for review
November 19, 2026 15:10
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 #338.
Repeated request headers currently validate only the first field line. For an integer-array header,
X-Values: 1followed byX-Values: badpasses, while the equivalent single lineX-Values: 1,badfails.Combine field lines in order with commas before schema validation, following RFC 9110 §5.2. Apply the same handling to the built-in JSON content-header decoder. Custom decoders continue to receive the original raw values, and request headers are not mutated.
Header arrays now run the existing item validation with either
explodesetting, since simple-style arrays use commas in both cases. Guard absentitemsso unconstrained arrays do not panic. This also means invalid single-line arrays withexplode: true, previously skipped, now fail validation.Regression coverage includes valid repeated lists, mixed CSV and repeated lines, invalid later values, mixed-case field names, order, scalar schemas, objects, missing headers, empty first values, both explode settings, absent items, JSON content headers, and the custom decoder contract. The new regressions failed against the original code.
Validation:
GOWORK=off go test ./...— passed.GOWORK=off go test -race ./parameters— passed.GOWORK=off golangci-lint run ./...— passed, zero issues.Risk: Low. Localized request-header validation change with regression coverage and no API changes. Previously ignored later values can now cause rejection; valid combined lists remain accepted. Existing array-schema validation rules are otherwise unchanged.
Rollout: none.