Skip to content

fix(header): improve original headers docs & parse tests#92

Merged
0x676e67 merged 3 commits into
mainfrom
header
Jun 5, 2026
Merged

fix(header): improve original headers docs & parse tests#92
0x676e67 merged 3 commits into
mainfrom
header

Conversation

@0x676e67
Copy link
Copy Markdown
Collaborator

@0x676e67 0x676e67 commented Jun 5, 2026

No description provided.

@0x676e67 0x676e67 changed the title chore(header): improve original headers docs & parse tests fix(header): improve original headers docs & parse tests Jun 5, 2026
@0x676e67 0x676e67 merged commit 7022a59 into main Jun 5, 2026
4 checks passed
@0x676e67 0x676e67 deleted the header branch June 5, 2026 13:39
@0x676e67 0x676e67 requested a review from Copilot June 6, 2026 04:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Ruby-facing documentation and behavior around orig_headers, aligning it with the underlying Rust/Wreq capability to preserve original header order and casing for HTTP/1 requests. It also adds an integration-style test suite to validate header ordering/casing preservation across several shuffled input cases.

Changes:

  • Update Ruby docs to describe orig_headers as Array<String> (ordered header names) rather than a hash.
  • Add OrigHeaders Rust wrapper + conversion logic to feed wreq::header::OrigHeaderMap into client/request builders.
  • Add new Ruby tests that verify echoed HTTP/1 headers preserve order and case when orig_headers is provided.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/orig_header_test.rb Adds HTTP/1 header order/casing preservation tests using orig_headers.
src/header.rs Introduces OrigHeaders wrapper and TryConvert from Ruby arrays.
src/extractor.rs Removes unused Version extractor implementation and updates imports.
src/error.rs Adds type_value_error_to_magnus helper for consistent type/value errors.
src/client/req.rs Plumbs orig_headers through request keyword parsing and into the request builder.
src/client.rs Plumbs orig_headers through client keyword parsing and into the client builder.
lib/wreq.rb Updates module method YARD docs to reflect orig_headers as Array<String>.
lib/wreq_ruby/client.rb Updates client and instance method YARD docs to reflect orig_headers as Array<String>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/header.rs
Comment on lines +181 to +187
let rarray = RArray::from_value(value)
.ok_or_else(|| type_value_error_to_magnus("Expected an array of strings"))?;

for value in rarray.into_iter().flat_map(RString::from_value) {
map.insert(value.to_bytes());
}

Comment thread src/client.rs
Comment on lines 147 to 153
@@ -152,7 +153,6 @@ impl Builder {
}
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.

2 participants