Repository navigation
feat(storage): extract shared header normalization utility - #2251
Merged
Merged
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
ferhatelmas
reviewed
Apr 15, 2026
ferhatelmas
reviewed
Apr 15, 2026
mandarini
force-pushed
the
feat/storage-header-util
branch
from
April 15, 2026 12:58
1481ef3 to
bb4e17a
Compare
ferhatelmas
reviewed
Apr 15, 2026
ferhatelmas
reviewed
Apr 15, 2026
mandarini
force-pushed
the
feat/storage-header-util
branch
from
April 16, 2026 13:06
bb4e17a to
dac0ac2
Compare
mandarini
force-pushed
the
feat/storage-header-util
branch
from
April 16, 2026 13:18
dac0ac2 to
1798eac
Compare
ferhatelmas
approved these changes
Apr 17, 2026
This was referenced Apr 20, 2026
mandarini
pushed a commit
to supabase/ssr
that referenced
this pull request
Apr 20, 2026
This PR updates `@supabase/supabase-js` to v2.104.0. **Source**: supabase-js-stable-release --- ## Release Notes ## v2.104.0 ## 2.104.0 (2026-04-20) ### 🚀 Features - **storage:** extract shared header normalization utility ([#2251](supabase/supabase-js#2251)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini ## v2.103.3 ## 2.103.3 (2026-04-16) ### 🩹 Fixes - **realtime:** throw Error objects instead of bare strings ([#2256](supabase/supabase-js#2256)) - **storage:** correct signedUrl type to allow null in createSignedUrls ([#2254](supabase/supabase-js#2254)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini - oniani1 This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini
pushed a commit
to supabase/supabase
that referenced
this pull request
Apr 20, 2026
This PR updates @supabase/*-js libraries to version 2.104.0. **Source**: supabase-js-stable-release **Changes**: - Updated @supabase/supabase-js to 2.104.0 - Updated @supabase/auth-js to 2.104.0 - Updated @supabase/realtime-js to 2.104.0 - Updated @supabase/postgest-js to 2.104.0 - Refreshed pnpm-lock.yaml --- ## Release Notes ## v2.104.0 ## 2.104.0 (2026-04-20) ### 🚀 Features - **storage:** extract shared header normalization utility ([#2251](supabase/supabase-js#2251)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini ## v2.103.3 ## 2.103.3 (2026-04-16) ### 🩹 Fixes - **realtime:** throw Error objects instead of bare strings ([#2256](supabase/supabase-js#2256)) - **storage:** correct signedUrl type to allow null in createSignedUrls ([#2254](supabase/supabase-js#2254)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini - oniani1 This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
spydon
added a commit
to supabase/supabase-py
that referenced
this pull request
Nov 3, 2026
## What kind of change does this PR introduce? Bug fix. Closes #1941. ## What is the current behavior? `_request` merges the client's headers into the per-call headers last, in a plain dict, so header names are compared case-sensitively. An upload header named `Authorization` is sent next to the client's `authorization`, and one named `authorization` is replaced by the client's value. ## What is the new behavior? `_request` now starts from the client's headers in an `httpx.Headers` and sets each per-call header on top, so a per-call header replaces the client's header of the same name in any casing. This applies to `upload`, `update` and `upload_to_signed_url`, matching supabase/supabase-js#2251. The other callers of `_request` only pass headers the client does not send (`x-upsert`, `Content-Type`), so they are unaffected. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Per-request headers now take precedence over client defaults for uploads, updates, and signed-URL uploads. Client headers take precedence over matching HTTP-client headers, while HTTP-client-only headers are retained. Client defaults are still sent when no per-request headers are supplied. * **Tests** * Added coverage for header precedence and retention across synchronous and asynchronous clients, including upload, update, and signed-URL upload requests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Lukas Klingsbo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What changed?
Extracted a reusable
setHeader()utility instorage-jsthat performs case-insensitive header deduplication. This consolidates header normalization logic that was previously scattered across multiple files:headers.ts- ExportssetHeader(headers, name, value)which removes any existing header matching the name (case-insensitive) before setting the new value. Returns a new object without mutating the input.fetch.ts- Removed the privatesetRequestHeaderfunction and replaced it with the sharedsetHeaderimport.BaseApiClient.ts- ThesetHeadermethod now delegates to the utility instead of inline lowercasing.StorageFileApi.ts- User-providedfileOptions.headersare now merged viasetHeaderin a loop instead of a raw object spread, preventing case-variant duplicates (e.g. a user passingContent-Typewhencontent-typealready exists).Why was this change needed?
PR #2211 lowercased all headers in the
BaseApiClientconstructor. PR #2220 fixed the resultingContent-Type/content-typeduplicate in_getRequestParamswith inline logic.The utility is scoped to
storage-jsfor now since other packages (postgrest-js,supabase-js) already use the nativeHeadersAPI which handles case-insensitivity natively.Breaking changes
Checklist
<type>(<scope>): <description>npx nx formatto ensure consistent code formattingAdditional notes
setHeaderutility is intentionally minimal: one function, one file, no class. It can be promoted to a shared package later if other SDK packages need it.fetch.test.tsandBaseApiClient.test.tscontinue to pass, covering the content-type deduplication behavior from PR fix(storage): avoid duplicate content-type headers in vector requests #2220.