Skip to content

storage: upload headers are sent alongside the client's headers or dropped, depending on their casing #1941

Closed

Description

@irisfield

Describe the bug

When upload, update or upload_to_signed_url is given a header in file_options["headers"] that the client already sends, the per-call value does not replace the client's. With Authorization, the request carries both values. With authorization, only the client's value is sent.

Related to supabase/supabase-js#2251 and supabase/supabase-js#2275.

Expected: the per-call header replaces the client's header of the same name, whatever its casing, so the request carries one authorization: Bearer user-jwt.

Reproduction

import httpx
from storage3 import SyncStorageClient

def handler(request):
    print(request.headers.get_list("authorization"))
    return httpx.Response(200, json={"Key": "photos/a.png", "Id": "id"})

client = SyncStorageClient(
    "http://localhost/storage/v1/",
    {"Authorization": "Bearer service-key", "apikey": "service-key"},
    http_client=httpx.Client(transport=httpx.MockTransport(handler)),
)
bucket = client.from_("photos")
bucket.upload("a.png", b"data", {"headers": {"Authorization": "Bearer user-jwt"}})
bucket.upload("b.png", b"data", {"headers": {"authorization": "Bearer user-jwt"}})

Prints:

['Bearer user-jwt', 'Bearer service-key']
['Bearer service-key']

Steps to reproduce

  1. Create a storage client with an Authorization header.
  2. Call upload() with a different Authorization value in file_options["headers"].
  3. Inspect the authorization header on the request that is sent.

Library affected

storage3

Library version

storage3 2.33.0

Python version

python 3.14.8

Activity

  1. added
    storage
    on Nov 3, 2026
  2. added a commit that references this issue on Nov 4, 2026
    09855c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    storage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions