Repository navigation
fix: a per-call header replaces the SDK's header whatever its case - #187
Conversation
RequestOptions additional_headers were merged into the SDK's headers by exact
name, so {"authorization": ...} was sent next to the SDK's Authorization as
a second header, and the same for User-Agent. A name now replaces the SDK's
header of that name in any casing, as an exactly matching name already did.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the change includes centralized case-insensitive header replacement with HTTP-level coverage for authorization and user-agent overrides.
No open issues 🎉
What changed in this PR
Makes per-call additional_headers override the SDK's built-in Authorization and User-Agent headers regardless of casing, preventing duplicate headers.
Changes:
- Filters SDK headers case-insensitively before applying per-call headers.
- Routes request-option headers through the centralized header-merging logic.
- Adds HTTP-level tests for authorization casing and user-agent replacement.
| File | Description |
|---|---|
| tests/unit/test_core.py | Adds coverage verifying authorization and user-agent headers are overridden without duplicates across casing variations. |
| src/fishaudio/core/client_wrapper.py | Implements case-insensitive replacement of SDK headers and applies it during request preparation. |
Review effort: Lite
Before:
RequestOptions(additional_headers={"authorization": ...})was sent as a second header next to the SDK'sAuthorization; only the exact spelling replaced it.After: a name in
additional_headersreplaces the SDK's header of that name in any casing.What users see: only callers who used another casing; one header is sent instead of two.
Verified: 4 tests, one through httpx with a mock transport; 3 fail without the fix.
poe checkandpoe test(334 passed) pass.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
After merging #182 into this branch:
User-Agentis the one exception. A caller'sUser-Agent, in any casing, is appended to the SDK's own and sent once, as #182 defines; it does not replace it.