Skip to content

fix: Keep the order of headers in HttpHeaders - #2568

Open
Mantisus wants to merge 1 commit into
apify:v2from
Mantisus:keep-header-order
Open

Mantisus wants to merge 1 commit into
apify:v2from
Mantisus:keep-header-order

Conversation

@Mantisus

@Mantisus Mantisus commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Description

HttpHeaders keeps the headers in the order they were passed instead of sorting them by name, so HttpxHttpClient and CurlImpersonateHttpClient send them in that order. Some sites check the header order, and browsers don't send headers alphabetically. ImpitHttpClient still sends the passed headers in an order of its own.

The extended unique key sorts the headers it hashes, so the same headers in a different order give the same key, and existing keys stay the same.

Testing

  • Unit tests for the order in HttpHeaders and for the unique key of headers in a different order, and an integration test for the order on the wire with HttpxHttpClient and CurlImpersonateHttpClient.

✍️ Drafted by Claude Code

@Mantisus Mantisus self-assigned this Dec 2, 2026
@Mantisus
Mantisus requested a review from vdusek December 2, 2026 16:45
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant