Skip to content

Commit 7f0ee3d

Browse files
committed
Fixed tests. Added a note for the enrichment error.
1 parent 23dafab commit 7f0ee3d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Sources/Core/Client/Result+ParseResponse.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ extension Result where Success == Moya.Response, Failure == ClientError {
6262
} catch let error as ClientError {
6363
errorBlock(error)
6464
} catch let error as DecodingError {
65+
if error.errorDescription == "Expected to decode Dictionary<String, Any> but found a string/data instead." {
66+
print("⚠️ Probably you are trying to get activities with enrichment. Usually, the actor field has wrong value.\n"
67+
+ "☝️ The enrichments is enabled by default in requests. Try to switch it off with the parameter: `enrich: false`."
68+
+ "ℹ️ Learn more about it here: https://getstream.io/docs/#enrichment_introduction")
69+
}
70+
6571
if case .success(let response) = self {
6672
errorBlock(ClientError.jsonDecode(error.localizedDescription, error, response.data))
6773
} else {

Tests/Core/ExtensionsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ final class ExtensionsTests: XCTestCase {
122122
let test = Test()
123123

124124
XCTAssertEqual(test.baseURL, URL(string: "https://getstream.io")!)
125-
XCTAssertEqual(test.headers, ["X-Stream-Client": "stream-swift-client-\(Client.version)"])
125+
XCTAssertEqual(test.headers?["X-Stream-Client"]!, "stream-swift-client-\(Client.version)")
126126
XCTAssertEqual(test.sampleData, Data())
127127
}
128128

0 commit comments

Comments
 (0)