Skip to content

Preserve header order with per-request emulation - #6

Open
Joseph-Mutua wants to merge 1 commit into
serpapi:mainfrom
Joseph-Mutua:fix/preserve-header-order-request-options
Open

Joseph-Mutua wants to merge 1 commit into
serpapi:mainfrom
Joseph-Mutua:fix/preserve-header-order-request-options

Conversation

@Joseph-Mutua

Copy link
Copy Markdown

Summary

  • preserve client-defined header ordering when applying per-request emulation
  • keep explicit request headers overriding emulation defaults
  • add deterministic regression coverage for the affected combination

What was happening

Per-request emulation replaces the request's original-header ordering, so a custom order configured on the client was lost. The wrapper now retains the explicit client order and merges it ahead of the selected request emulation's order.

Testing

  • bundle exec rake compile
  • bundle exec ruby -Itest test/client_test.rb
  • bundle exec rake test
  • reran the issue reproduction against tls.peet.ws and verified all five cases

Fixes #1

@Joseph-Mutua

Copy link
Copy Markdown
Author

Evidence for the issue reproduction and verification:

@Joseph-Mutua

Joseph-Mutua commented Sep 16, 2026 •

Copy link
Copy Markdown
Author

@zyc9012 @moya1295 you can verify if this is adequate to close the issue. Any questions/requests welcome

@Joseph-Mutua
Joseph-Mutua force-pushed the fix/preserve-header-order-request-options branch from f323835 to b51f498 Compare September 17, 2026 17:41
@Joseph-Mutua

Copy link
Copy Markdown
Author

Hi @zyc9012 @moya1295, I’ve rebased this onto the current main branch and resolved the changes introduced since the PR was opened. I also narrowed the regression test so it only checks the reported header-ordering behavior.

Local verification passes:

  • native extension compilation
  • focused client tests: 12 tests, 38 assertions
  • full suite: 59 tests, 172 assertions
  • Rust test: 1 passed

GitHub Actions is currently waiting for maintainer approval. When you have a chance, could you approve the workflows and review the updated diff?

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 order is not maintained when headers or header_options are passed as options to GET method call

1 participant