[ad_1]
I am utilizing Apollo GraphQL for API response. Added ApolloInterceptor. The issue is that response is all the time nil when I attempt to print it to get response physique, even when request is profitable.
class CustomInterceptor: ApolloInterceptor {
func interceptAsync<Operation: GraphQLOperation>(
chain: RequestChain,
request: HTTPRequest<Operation>,
response: HTTPResponse<Operation>?,
completion: @escaping (Swift.Consequence<GraphQLResult<Operation.Information>, Error>) -> Void) {
let accessToken = KeychainWrapper.normal.string(forKey: "accessToken")
request.addHeader(identify: "Authorization", worth: accessToken ?? "")
print(accessToken)
print("request :(request)")
print("response :(String(describing: response))")
chain.proceedAsync(request: request,
response: response,
completion: completion)
}
}
[ad_2]
