DEV: Detect duplicate headers in client spec http_parse helper#380
Merged
DEV: Detect duplicate headers in client spec http_parse helper#380
Conversation
563468a to
53637f8
Compare
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.
53637f8 to
dea50f8
Compare
SamSaffron
approved these changes
Feb 13, 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.
Follow up to 2d00142.
What is the problem?
2d00142 fixed a bug where
MessageBus::Client#write_headerswasproducing duplicate
Content-Typeheaders due to inconsistent casing.However, the
http_parsetest helper inclient_spec.rbstores headersin a hash which silently overwrites duplicates. For example, the
"can chunk replies"test parses a response withhttp_parseand assertsheaders["content-type"]— but ifwrite_headerswrotecontent-typetwice, 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_parsethat raises if thesame header name appears more than once.