Skip to content

Commit e127e8d

Browse files
fix: realtime events payload
1 parent 9611755 commit e127e8d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Sources/Appwrite/Client.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ open class Client {
323323
return response.body as! T
324324
default:
325325
let data = try await response.body.collect(upTo: Int.max)
326+
if data.readableBytes == 0 {
327+
return true as! T
328+
}
326329
let dict = try JSONSerialization.jsonObject(with: data) as? [String: Any]
327330

328331
return converter?(dict!) ?? dict! as! T

Sources/Appwrite/Models/AppwriteError.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,19 @@ open class AppwriteError : Swift.Error, Decodable {
1212
self.type = type
1313
}
1414
}
15+
16+
extension AppwriteError: CustomStringConvertible {
17+
public var description: String {
18+
get {
19+
return self.message
20+
}
21+
}
22+
}
23+
24+
extension AppwriteError: LocalizedError {
25+
public var errorDescription: String? {
26+
get {
27+
return self.message
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)