Skip to content

Commit 99a0721

Browse files
committed
Add custom headers
1 parent 1329339 commit 99a0721

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let package = Package(
4141
"-warn-concurrency",
4242
"-enable-actor-data-race-checks",
4343
]
44-
)
44+
),
4545
]
4646
),
4747
]

Sources/Supabase/SupabaseClient.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ public class SupabaseClient {
5959
/// - supabaseURL: Unique Supabase project url
6060
/// - supabaseKey: Supabase anonymous API Key
6161
/// - schema: Database schema name, defaults to `public`
62+
/// - headers: Optional headers for initializing the client.
6263
public init(
6364
supabaseURL: URL,
6465
supabaseKey: String,
6566
schema: String = "public",
67+
headers: [String: String] = [:],
6668
httpClient: HTTPClient = HTTPClient()
6769
) {
6870
self.supabaseURL = supabaseURL
@@ -73,7 +75,7 @@ public class SupabaseClient {
7375
defaultHeaders = [
7476
"X-Client-Info": "supabase-swift/\(version)",
7577
"apikey": supabaseKey,
76-
]
78+
].merging(headers) { old, _ in old }
7779

7880
auth = GoTrueClient(
7981
url: supabaseURL.appendingPathComponent("/auth/v1"),

0 commit comments

Comments
 (0)