Skip to content

Comments

DEV: Detect duplicate headers in client spec http_parse helper#380

Merged
tgxworld merged 1 commit intomainfrom
dev/test-content-type-dedup
Feb 13, 2026
Merged

DEV: Detect duplicate headers in client spec http_parse helper#380
tgxworld merged 1 commit intomainfrom
dev/test-content-type-dedup

Conversation

@tgxworld
Copy link
Contributor

@tgxworld tgxworld commented Feb 13, 2026

Follow up to 2d00142.

What is the problem?

2d00142 fixed a bug where MessageBus::Client#write_headers was
producing duplicate Content-Type headers due to inconsistent casing.
However, the http_parse test helper in client_spec.rb stores headers
in a hash which silently overwrites duplicates. For example, the "can chunk replies" test parses a response with http_parse and asserts
headers["content-type"] — but if write_headers wrote content-type
twice, the hash would only keep the last value and the test would still
pass.

What is the solution?

Added a duplicate detection check in http_parse that raises if the
same header name appears more than once.

@tgxworld tgxworld force-pushed the dev/test-content-type-dedup branch from 563468a to 53637f8 Compare February 13, 2026 02:28
What is the problem?

2d00142 fixed a bug where `MessageBus::Client#write_headers` was
producing duplicate `Content-Type` headers due to inconsistent casing.
However, the `http_parse` test helper in `client_spec.rb` stores headers
in a hash which silently overwrites duplicates. For example, the `"can
chunk replies"` test parses a response with `http_parse` and asserts
`headers["content-type"]` — but if `write_headers` wrote `content-type`
twice, the hash would only keep the last value and the test would still
pass.

What is the solution?

Added a duplicate detection check in `http_parse` that raises if the
same header name appears more than once.
@tgxworld tgxworld force-pushed the dev/test-content-type-dedup branch from 53637f8 to dea50f8 Compare February 13, 2026 04:43
@tgxworld tgxworld changed the title DEV: Add test for content-type header deduplication in Client DEV: Detect duplicate headers in client spec http_parse helper Feb 13, 2026
@tgxworld tgxworld merged commit bf541d7 into main Feb 13, 2026
11 checks passed
@tgxworld tgxworld deleted the dev/test-content-type-dedup branch February 13, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants