Skip to content

Commit 1fd4ba7

Browse files
shinping2shin
andauthored
fix(api): populate the auth mode when parsing the request response. So AppSyncListProvider.getNextPage() will have the auth mode. (#4156)
Co-authored-by: shin <shin@shins-MacBook-Air.local>
1 parent 69ce4a2 commit 1fd4ba7

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListProvider.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class AppSyncListProvider<Element: Model>: ModelListProvider {
5959
elements: listResponse.items,
6060
nextToken: listResponse.nextToken,
6161
apiName: payload.apiName,
62+
authMode: payload.authMode,
6263
limit: payload.limit,
6364
filter: payload.graphQLFilter
6465
)

AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class AppSyncListProviderTests: XCTestCase {
6262
let appSyncPayload = AppSyncListPayload(
6363
graphQLData: json,
6464
apiName: "apiName",
65-
authMode: nil,
65+
authMode: .amazonCognitoUserPools,
6666
variables: variables
6767
)
6868
let provider = try AppSyncListProvider<Post4>(payload: appSyncPayload)
@@ -73,6 +73,7 @@ class AppSyncListProviderTests: XCTestCase {
7373
XCTAssertEqual(elements.count, 2)
7474
XCTAssertEqual(nextToken, "nextToken")
7575
XCTAssertEqual(provider.apiName, "apiName")
76+
XCTAssertEqual(provider.authMode, .amazonCognitoUserPools)
7677
XCTAssertEqual(provider.limit, 500)
7778
XCTAssertNotNil(filter)
7879
}

0 commit comments

Comments
 (0)