@@ -51,11 +51,7 @@ public class PostgrestBuilder: @unchecked Sendable {
51
51
public func execute(
52
52
options: FetchOptions = FetchOptions ( )
53
53
) async throws -> PostgrestResponse < Void > {
54
- mutableState. withValue {
55
- $0. fetchOptions = options
56
- }
57
-
58
- return try await execute { _ in ( ) }
54
+ try await execute ( options: options) { _ in ( ) }
59
55
}
60
56
61
57
/// Executes the request and returns a response of the specified type.
@@ -66,11 +62,7 @@ public class PostgrestBuilder: @unchecked Sendable {
66
62
public func execute< T: Decodable > (
67
63
options: FetchOptions = FetchOptions ( )
68
64
) async throws -> PostgrestResponse < T > {
69
- mutableState. withValue {
70
- $0. fetchOptions = options
71
- }
72
-
73
- return try await execute { [ configuration] data in
65
+ try await execute ( options: options) { [ configuration] data in
74
66
do {
75
67
return try configuration. decoder. decode ( T . self, from: data)
76
68
} catch {
@@ -80,8 +72,13 @@ public class PostgrestBuilder: @unchecked Sendable {
80
72
}
81
73
}
82
74
83
- private func execute< T> ( decode: ( Data ) throws -> T ) async throws -> PostgrestResponse < T > {
75
+ private func execute< T> (
76
+ options: FetchOptions ,
77
+ decode: ( Data ) throws -> T
78
+ ) async throws -> PostgrestResponse < T > {
84
79
mutableState. withValue {
80
+ $0. fetchOptions = options
81
+
85
82
if $0. fetchOptions. head {
86
83
$0. request. method = . head
87
84
}
0 commit comments