Skip to content

fix(common): override configured headers case-insensitively - #2580

Open
zakazaka95 wants to merge 1 commit into
alchemyplatform:mainfrom
zakazaka95:fix/configured-header-precedence
Open

zakazaka95 wants to merge 1 commit into
alchemyplatform:mainfrom
zakazaka95:fix/configured-header-precedence

Conversation

@zakazaka95

@zakazaka95 zakazaka95 commented Nov 6, 2026 •

Copy link
Copy Markdown

Configured authentication and SDK-version headers already override exact-case caller headers. Differently cased names survive the object spread, so fetch can combine caller and configured values, for example Bearer caller-token, Bearer configured-key.

Remove only the case-insensitive copies of headers that the SDK overrides, using a fresh caller-header object before adding the existing SDK keys. Preserve JWT precedence, unrelated headers, caller ownership and output key casing.

Validation:

  • Final regressions on the original helper: 4 failures and 177 passes. Corrected stock alchemy/common project: all 181 tests pass, independently repeated.
  • Normal pnpm run build:libs: all 5 tasks pass. Scoped documented test:typecheck passes.
  • Scoped ESLint/Prettier and normal Husky lint-staged/commitlint hooks pass.
  • Other projects requiring chain fixtures and full repository lint were not run. The normal workspace postinstall encounters an existing missing chmod command in halp on this Windows toolchain; locked dependencies and the relevant normal library/test targets were still verified.

The tests construct the actual transport and inspect headers without making requests. No credentials, RPC, wallet or paid service is used. Prepared and independently reviewed with AI assistance.

Pull Request Checklist

  • Did you add new tests and confirm existing tests pass? (pnpm test) — all 181 common-package tests pass; chain-dependent projects were not run.
  • Updated docs: existing header precedence is preserved; no new public API.
  • Commits follow Conventional Commits, verified by the normal hook.
  • PR title follows Conventional Commits.
  • Breaking-change marker: not applicable.
  • Full repository lint:check; scoped lint and the normal staged-file gate pass.
  • Followed the contribution workflow within the stated offline validation limits.

PR-Codex overview

This PR focuses on enhancing the header management in the alchemyTransport function by normalizing header names, removing certain headers, and ensuring proper handling of authorization tokens.

Detailed summary

  • Updated alchemyTransport in headers.ts to normalize header names and delete specific headers.
  • Added tests in alchemyTransport.test.ts to verify header management:
    • Case-insensitive header overrides.
    • JWT priority over API keys.
    • Preservation of caller authorization.
    • Retention of exact-case configured headers.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Preserve the established configured authentication and SDK-version precedence
for all accepted header input shapes, while retaining other caller values
and SDK output casing.

Co-authored-by: Codex <codex@openai.com>
@Mygee2020

Mygee2020 commented Nov 6, 2026 via email

Copy link
Copy Markdown

@pr-codex

pr-codex Bot commented Nov 6, 2026

Copy link
Copy Markdown

{your question}

You can view, comment on, or merge this pull request online at:

  #2580

Commit Summary

  • 3fb6c82 fix(common): override configured headers case-insensitively

File Changes

(2 files)

  • M packages/common/src/utils/headers.ts (12)
  • M packages/common/tests/transport/alchemyTransport.test.ts (81)

Patch Links:

—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: @.***>

@Mygee2020 What changes were made in the headers.ts file?

The changes made in the packages/common/src/utils/headers.ts file are:

  1. Introduced a new variable callerHeaders which is created by converting headers to an object.
  2. Added a loop to iterate over callerHeaders:
    • Normalizes the header names to lowercase.
    • Deletes the headers alchemy-aa-sdk-version and authorization if they exist.
  3. Updated the return statement to use callerHeaders instead of directly converting headers.

The final return structure now includes:

  • "Alchemy-AA-Sdk-Version": VERSION
  • Conditional inclusion of the Authorization header if a bearerToken exists.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants