@@ -47,7 +47,7 @@ public final class SupabaseClient: Sendable {
47
47
$0. rest = PostgrestClient (
48
48
url: databaseURL,
49
49
schema: options. db. schema,
50
- headers: _headers ,
50
+ headers: headers ,
51
51
logger: options. global. logger,
52
52
fetch: { request, bodyData in
53
53
if let bodyData {
@@ -72,7 +72,7 @@ public final class SupabaseClient: Sendable {
72
72
$0. storage = SupabaseStorageClient (
73
73
configuration: StorageClientConfiguration (
74
74
url: storageURL,
75
- headers: _headers ,
75
+ headers: headers ,
76
76
session: StorageHTTPSession { request, bodyData in
77
77
if let bodyData {
78
78
return try await self . uploadWithAuth ( for: request, from: bodyData)
@@ -100,7 +100,7 @@ public final class SupabaseClient: Sendable {
100
100
if $0. functions == nil {
101
101
$0. functions = FunctionsClient (
102
102
url: functionsURL,
103
- headers: _headers ,
103
+ headers: headers ,
104
104
region: options. functions. region,
105
105
logger: options. global. logger,
106
106
fetch: { request, bodyData in
@@ -116,14 +116,11 @@ public final class SupabaseClient: Sendable {
116
116
return $0. functions!
117
117
}
118
118
}
119
-
120
- let _headers : HTTPFields
119
+
121
120
/// Headers provided to the inner clients on initialization.
122
121
///
123
122
/// - 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
127
124
128
125
struct MutableState {
129
126
var listenForAuthEventsTask : Task < Void , Never > ?
@@ -177,14 +174,14 @@ public final class SupabaseClient: Sendable {
177
174
. authorization: " Bearer \( supabaseKey) " ,
178
175
. apiKey: supabaseKey,
179
176
]
180
- _headers = headers. merging ( with: options. global. headers)
177
+ self . headers = headers. merging ( with: options. global. headers)
181
178
182
179
// default storage key uses the supabase project ref as a namespace
183
180
let defaultStorageKey = " sb- \( supabaseURL. host!. split ( separator: " . " ) [ 0 ] ) -auth-token "
184
181
185
182
_auth = AuthClient (
186
183
url: supabaseURL. appendingPathComponent ( " /auth/v1 " ) ,
187
- headers: _headers ,
184
+ headers: self . headers ,
188
185
flowType: options. auth. flowType,
189
186
redirectToURL: options. auth. redirectToURL,
190
187
storageKey: options. auth. storageKey ?? defaultStorageKey,
@@ -206,13 +203,13 @@ public final class SupabaseClient: Sendable {
206
203
_realtime = UncheckedSendable (
207
204
RealtimeClient (
208
205
supabaseURL. appendingPathComponent ( " /realtime/v1 " ) . absoluteString,
209
- headers: _headers ,
210
- params: _headers . dictionary
206
+ headers: headers ,
207
+ params: headers . dictionary
211
208
)
212
209
)
213
210
214
211
var realtimeOptions = options. realtime
215
- realtimeOptions. headers. merge ( with: _headers )
212
+ realtimeOptions. headers. merge ( with: self . headers )
216
213
if realtimeOptions. logger == nil {
217
214
realtimeOptions. logger = options. global. logger
218
215
}
0 commit comments