Skip to content

Fix case-insensitive header overrides#3486

Open
fallintoplace wants to merge 1 commit into
openai:mainfrom
fallintoplace:fix/case-insensitive-header-merging
Open

Fix case-insensitive header overrides#3486
fallintoplace wants to merge 1 commit into
openai:mainfrom
fallintoplace:fix/case-insensitive-header-merging

Conversation

@fallintoplace

Copy link
Copy Markdown
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

HTTP header names are case-insensitive, but the SDK currently merges them with a normal dictionary. A lowercase per-request authorization override therefore does not replace the generated Authorization header; both values are sent. A lowercase authorization: Omit() also fails to remove the generated credential.

This change adds a header-specific case-insensitive merge helper and uses it for HTTP requests and realtime/response websocket connections. Later header mappings keep taking precedence, and Omit() removes matching headers regardless of casing. The generic mapping helper remains unchanged so query and JSON keys stay case-sensitive.

Regression coverage verifies lowercase authorization replacement and removal for sync and async clients, including an assertion that only one authorization value remains.

Additional context & links

Validated with 177 client tests, 59 Azure tests, focused Bedrock auth/header tests, Ruff, Pyright, and mypy.

@fallintoplace fallintoplace requested a review from a team as a code owner July 10, 2026 23:40
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.

1 participant