From 3d46f439bf32be6e3ccaf815bbf64a0244c31126 Mon Sep 17 00:00:00 2001 From: Elijah Quartey Date: Tue, 26 Mar 2024 13:59:35 -0500 Subject: [PATCH] fix(api): Paginated GraphQL preserve request params --- .../lib/src/graphql/helpers/graphql_response_decoder.dart | 2 ++ .../api/amplify_api_dart/test/graphql_helpers_test.dart | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/api/amplify_api_dart/lib/src/graphql/helpers/graphql_response_decoder.dart b/packages/api/amplify_api_dart/lib/src/graphql/helpers/graphql_response_decoder.dart index fcba949129..538a8ba855 100644 --- a/packages/api/amplify_api_dart/lib/src/graphql/helpers/graphql_response_decoder.dart +++ b/packages/api/amplify_api_dart/lib/src/graphql/helpers/graphql_response_decoder.dart @@ -99,6 +99,8 @@ class GraphQLResponseDecoder { decodePath: request.decodePath, variables: variablesWithNextToken, modelType: request.modelType, + authorizationMode: request.authorizationMode, + apiName: request.apiName, ); } decodedData = modelType.fromJson( diff --git a/packages/api/amplify_api_dart/test/graphql_helpers_test.dart b/packages/api/amplify_api_dart/test/graphql_helpers_test.dart index 3b4747ab9a..64e286d174 100644 --- a/packages/api/amplify_api_dart/test/graphql_helpers_test.dart +++ b/packages/api/amplify_api_dart/test/graphql_helpers_test.dart @@ -231,7 +231,11 @@ void main() { () async { const limit = 2; final GraphQLRequest> req = - ModelQueries.list(Blog.classType, limit: limit); + ModelQueries.list( + Blog.classType, + limit: limit, + authorizationMode: APIAuthorizationType.iam, + ); const data = '''{ "listBlogs": { @@ -263,6 +267,8 @@ void main() { response.data?.nextToken, ); expect(resultRequest?.variables['limit'], limit); + expect(resultRequest?.authorizationMode, req.authorizationMode); + expect(resultRequest?.apiName, req.apiName); }); test(