Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response value getting nil #3385

Closed
Rushabh5 opened this issue May 22, 2024 · 2 comments
Closed

Response value getting nil #3385

Rushabh5 opened this issue May 22, 2024 · 2 comments
Labels
question Issues that have a question which should be addressed

Comments

@Rushabh5
Copy link

Question

I am adding a Token in the TokenAddingInterceptor file but that response value is nil so how can I get the response value?

class NetworkInterceptorProvider: DefaultInterceptorProvider {
    override func interceptors<Operation: GraphQLOperation>(for operation: Operation) -> [ApolloInterceptor] {
        var interceptors = super.interceptors(for: operation)
        interceptors.insert(TokenAddingInterceptor(), at: 0)
        return interceptors
    }


    override func additionalErrorInterceptor<Operation: GraphQLOperation>(for: Operation) -> ApolloErrorInterceptor? {
        return nil
    }

}
@Rushabh5 Rushabh5 added the question Issues that have a question which should be addressed label May 22, 2024
@calvincestari
Copy link
Member

HI @Rushabh5 - I assume the token is required to be able to execute the query which means it should be added to the request, not the response.

If you are really needing to modify the response then you will need to add your interceptor after the NetworkFetchInterceptor because that is where the request actually gets sent, so there will only be a valid response object after that interceptor.

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that have a question which should be addressed
Projects
None yet
Development

No branches or pull requests

2 participants