From 57da7c84f4a6fb1f8bd7adb7598bae11b25b9be2 Mon Sep 17 00:00:00 2001 From: Di Wu Date: Tue, 12 Sep 2023 11:18:18 -0700 Subject: [PATCH] update interceptor doc comment --- .../Configuration/AWSAPIEndpointInterceptors.swift | 13 ++++++++----- .../Operation/AWSGraphQLOperation.swift | 4 ++-- .../AWSAPIPlugin/Operation/AWSRESTOperation.swift | 4 ++-- .../GraphQLModelBasedTests+List.swift | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift index 7da01cca44..9be9d3c05b 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift @@ -9,6 +9,14 @@ import Amplify import Foundation import AWSPluginsCore +/// The order of interceptor decoration is as follows: +/// 1. **prelude interceptors** +/// 2. **cutomize headers** +/// 3. **customer interceptors** +/// 4. **postlude interceptors** +/// +/// **Prelude** and **postlude** interceptors are used by library maintainers to +/// integrate essential functionality for a variety of authentication types. struct AWSAPIEndpointInterceptors { // API name let apiEndpointName: APIEndpointName @@ -16,11 +24,6 @@ struct AWSAPIEndpointInterceptors { let apiAuthProviderFactory: APIAuthProviderFactory let authService: AWSAuthServiceBehavior? - /// The order of interceptor decoration is as follows: - /// 1. **prelude interceptors**: append default auth info - /// 2. **cutomize headers**: headers provided when constructing the request - /// 3. **customer interceptors**: customer defined interceptors - /// 4. **postlude interceptors**: calculate checksums, signatures var preludeInterceptors: [URLRequestInterceptor] = [] var interceptors: [URLRequestInterceptor] = [] diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift index faa35764d9..859981e321 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift @@ -179,8 +179,8 @@ final public class AWSGraphQLOperation: GraphQLOperation { } catch { return .failure( APIError.operationError( - "Failed to intercept request fully.", - "Something wrong with the interceptor", + "Failed to intercept request with \(type(of: interceptor)). Error message: \(error.localizedDescription).", + "See underlying error for more details", error ) ) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift index 18c2979097..3680b22728 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift @@ -160,8 +160,8 @@ final public class AWSRESTOperation: AmplifyOperation< } catch { return .failure( APIError.operationError( - "Failed to intercept request fully.", - "Something wrong with the interceptor", + "Failed to intercept request with \(type(of: interceptor)). Error message: \(error.localizedDescription).", + "See underlying error for more details", error ) ) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift index bf38826118..c42916e6e6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift @@ -39,7 +39,7 @@ extension GraphQLModelBasedTests { let post = Post.keys let predicate = post.id == uuid1 || post.id == uuid2 var results: List? - let response = try await Amplify.API.query(request: .list(Post.self, where: predicate, limit: 1)) + let response = try await Amplify.API.query(request: .list(Post.self, where: predicate, limit: 3000)) guard case .success(let graphQLresponse) = response else { XCTFail("Missing successful response")