@@ -27,8 +27,6 @@ final class StorageFileAPITests: XCTestCase {
27
27
let configuration = URLSessionConfiguration . default
28
28
configuration. protocolClasses = [ MockingURLProtocol . self]
29
29
30
- _ = URLSession ( configuration: configuration)
31
-
32
30
storage = SupabaseStorageClient (
33
31
configuration: StorageClientConfiguration (
34
32
url: url,
@@ -936,6 +934,7 @@ final class StorageFileAPITests: XCTestCase {
936
934
#"""
937
935
curl \
938
936
--request POST \
937
+ --header "Cache-Control: max-age=3600" \
939
938
--header "Content-Length: 390" \
940
939
--header "Content-Type: multipart/form-data; boundary=alamofire.boundary.e56f43407f772505" \
941
940
--header "X-Client-Info: storage-swift/0.0.0" \
@@ -992,25 +991,26 @@ final class StorageFileAPITests: XCTestCase {
992
991
#"""
993
992
curl \
994
993
--request POST \
995
- --header "Content-Length: 392" \
994
+ --header "Cache-Control: max-age=3600" \
995
+ --header "Content-Length: 391" \
996
996
--header "Content-Type: multipart/form-data; boundary=alamofire.boundary.e56f43407f772505" \
997
997
--header "X-Client-Info: storage-swift/0.0.0" \
998
998
--header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
999
999
--header "x-upsert: false" \
1000
- --data "--alamofire.boundary.e56f43407f772505
1001
- Content-Disposition: form-data; name=\"cacheControl\"
1002
-
1003
- 3600
1004
- --alamofire.boundary.e56f43407f772505
1005
- Content-Disposition: form-data; name=\"metadata\"
1006
-
1007
- {\"mode\":\"test\"}
1008
- --alamofire.boundary.e56f43407f772505
1009
- Content-Disposition: form-data; name=\"\"; filename=\"test.txt\"
1010
- Content-Type: text/plain
1011
-
1012
- hello world!
1013
- --alamofire.boundary.e56f43407f772505--
1000
+ --data "--alamofire.boundary.e56f43407f772505\#r
1001
+ Content-Disposition: form-data; name=\"cacheControl\"\#r
1002
+ \#r
1003
+ 3600\#r
1004
+ --alamofire.boundary.e56f43407f772505\#r
1005
+ Content-Disposition: form-data; name=\"metadata\"\#r
1006
+ \#r
1007
+ {\"mode\":\"test\"}\#r
1008
+ --alamofire.boundary.e56f43407f772505\#r
1009
+ Content-Disposition: form-data; name=\"\"; filename=\"test.txt\"\#r
1010
+ Content-Type: text/plain\#r
1011
+ \#r
1012
+ hello world!\#r
1013
+ --alamofire.boundary.e56f43407f772505--\#r
1014
1014
" \
1015
1015
"http://localhost:54321/storage/v1/object/bucket/test.txt"
1016
1016
"""#
@@ -1055,26 +1055,26 @@ final class StorageFileAPITests: XCTestCase {
1055
1055
#"""
1056
1056
curl \
1057
1057
--request POST \
1058
- --header "Cache-Control: max-age=3600 " \
1059
- --header "Content-Length: 390 " \
1058
+ --header "Cache-Control: max-age=7200 " \
1059
+ --header "Content-Length: 388 " \
1060
1060
--header "Content-Type: multipart/form-data; boundary=alamofire.boundary.e56f43407f772505" \
1061
1061
--header "X-Client-Info: storage-swift/0.0.0" \
1062
1062
--header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
1063
1063
--header "x-upsert: false" \
1064
- --data "--alamofire.boundary.e56f43407f772505
1065
- Content-Disposition: form-data; name=\"cacheControl\"
1066
-
1067
- 7200
1068
- --alamofire.boundary.e56f43407f772505
1069
- Content-Disposition: form-data; name=\"metadata\"
1070
-
1071
- {\"custom\":\"value\",\" number\":42}
1072
- --alamofire.boundary.e56f43407f772505
1073
- Content-Disposition: form-data; name=\"\"; filename=\"test.txt\"
1074
- Content-Type: text/plain
1075
-
1076
- hello world
1077
- --alamofire.boundary.e56f43407f772505--
1064
+ --data "--alamofire.boundary.e56f43407f772505\#r
1065
+ Content-Disposition: form-data; name=\"cacheControl\"\#r
1066
+ \#r
1067
+ 7200\#r
1068
+ --alamofire.boundary.e56f43407f772505\#r
1069
+ Content-Disposition: form-data; name=\"metadata\"\#r
1070
+ \#r
1071
+ {\"number\":42}\#r
1072
+ --alamofire.boundary.e56f43407f772505\#r
1073
+ Content-Disposition: form-data; name=\"\"; filename=\"test.txt\"\#r
1074
+ Content-Type: text/plain\#r
1075
+ \#r
1076
+ hello world\#r
1077
+ --alamofire.boundary.e56f43407f772505--\#r
1078
1078
" \
1079
1079
"http://localhost:54321/storage/v1/object/bucket/test.txt"
1080
1080
"""#
@@ -1087,7 +1087,6 @@ final class StorageFileAPITests: XCTestCase {
1087
1087
options: FileOptions (
1088
1088
cacheControl: " 7200 " ,
1089
1089
metadata: [
1090
- " custom " : " value " ,
1091
1090
" number " : 42
1092
1091
]
1093
1092
)
@@ -1119,10 +1118,20 @@ final class StorageFileAPITests: XCTestCase {
1119
1118
do {
1120
1119
_ = try await storage. from ( " bucket " ) . upload ( " test.txt " , data: Data ( " hello world " . utf8) )
1121
1120
XCTFail ( " Expected error but got success " )
1122
- } catch let error as StorageError {
1123
- XCTAssertEqual ( error. statusCode, " 500 " )
1124
- XCTAssertEqual ( error. message, " Internal server error " )
1125
- XCTAssertEqual ( error. error, " InternalError " )
1121
+ } catch {
1122
+ assertInlineSnapshot ( of: error, as: . customDump) {
1123
+ """
1124
+ AFError.responseValidationFailed(
1125
+ reason: .customValidationFailed(
1126
+ error: StorageError(
1127
+ statusCode: " 500 " ,
1128
+ message: " Internal server error " ,
1129
+ error: " InternalError "
1130
+ )
1131
+ )
1132
+ )
1133
+ """
1134
+ }
1126
1135
}
1127
1136
}
1128
1137
}
0 commit comments