@@ -47,7 +47,7 @@ public final class SupabaseClient: Sendable {
4747 $0. rest = PostgrestClient (
4848 url: databaseURL,
4949 schema: options. db. schema,
50- headers: _headers ,
50+ headers: headers ,
5151 logger: options. global. logger,
5252 fetch: { request, bodyData in
5353 if let bodyData {
@@ -72,7 +72,7 @@ public final class SupabaseClient: Sendable {
7272 $0. storage = SupabaseStorageClient (
7373 configuration: StorageClientConfiguration (
7474 url: storageURL,
75- headers: _headers ,
75+ headers: headers ,
7676 session: StorageHTTPSession { request, bodyData in
7777 if let bodyData {
7878 return try await self . uploadWithAuth ( for: request, from: bodyData)
@@ -100,7 +100,7 @@ public final class SupabaseClient: Sendable {
100100 if $0. functions == nil {
101101 $0. functions = FunctionsClient (
102102 url: functionsURL,
103- headers: _headers ,
103+ headers: headers ,
104104 region: options. functions. region,
105105 logger: options. global. logger,
106106 fetch: { request, bodyData in
@@ -116,14 +116,11 @@ public final class SupabaseClient: Sendable {
116116 return $0. functions!
117117 }
118118 }
119-
120- let _headers : HTTPFields
119+
121120 /// Headers provided to the inner clients on initialization.
122121 ///
123122 /// - Note: This collection is non-mutable, if you want to provide different headers, pass it in ``SupabaseClientOptions/GlobalOptions/headers``.
124- public var headers : [ String : String ] {
125- _headers. dictionary
126- }
123+ public let headers : HTTPFields
127124
128125 struct MutableState {
129126 var listenForAuthEventsTask : Task < Void , Never > ?
@@ -177,14 +174,14 @@ public final class SupabaseClient: Sendable {
177174 . authorization: " Bearer \( supabaseKey) " ,
178175 . apiKey: supabaseKey,
179176 ]
180- _headers = headers. merging ( with: options. global. headers)
177+ self . headers = headers. merging ( with: options. global. headers)
181178
182179 // default storage key uses the supabase project ref as a namespace
183180 let defaultStorageKey = " sb- \( supabaseURL. host!. split ( separator: " . " ) [ 0 ] ) -auth-token "
184181
185182 _auth = AuthClient (
186183 url: supabaseURL. appendingPathComponent ( " /auth/v1 " ) ,
187- headers: _headers ,
184+ headers: self . headers ,
188185 flowType: options. auth. flowType,
189186 redirectToURL: options. auth. redirectToURL,
190187 storageKey: options. auth. storageKey ?? defaultStorageKey,
@@ -206,13 +203,13 @@ public final class SupabaseClient: Sendable {
206203 _realtime = UncheckedSendable (
207204 RealtimeClient (
208205 supabaseURL. appendingPathComponent ( " /realtime/v1 " ) . absoluteString,
209- headers: _headers ,
210- params: _headers . dictionary
206+ headers: headers ,
207+ params: headers . dictionary
211208 )
212209 )
213210
214211 var realtimeOptions = options. realtime
215- realtimeOptions. headers. merge ( with: _headers )
212+ realtimeOptions. headers. merge ( with: self . headers )
216213 if realtimeOptions. logger == nil {
217214 realtimeOptions. logger = options. global. logger
218215 }
0 commit comments