Skip to content

fix: validate all repeated request header values - #349

Merged
daveshanley merged 1 commit into
mainfrom
codex/fix-338-repeated-headers
Nov 19, 2026
Merged

daveshanley merged 1 commit into
mainfrom
codex/fix-338-repeated-headers

Conversation

@daveshanley

Copy link
Copy Markdown
Member

Fixes #338.

Repeated request headers currently validate only the first field line. For an integer-array header, X-Values: 1 followed by X-Values: bad passes, while the equivalent single line X-Values: 1,bad fails.

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 explode setting, since simple-style arrays use commas in both cases. Guard absent items so unconstrained arrays do not panic. This also means invalid single-line arrays with explode: 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.
  • gofumpt and diff whitespace checks — passed.
  • Independent correctness/Dave and de-slop reviews — no material findings.

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.

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.76%. Comparing base (dad8fd9) to head (fe7214c).
⚠️ Report is 1 commits behind head on main.

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           
Flag Coverage Δ
unittests 98.76% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@daveshanley
daveshanley marked this pull request as ready for review November 19, 2026 15:10
@daveshanley
daveshanley merged commit a898dc3 into main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Header parameter validation only checks the first header value

1 participant