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

PersistedQueryLink work with bug. The full request goes through the GET method #8936

Open
rieset opened this issue Oct 17, 2021 · 0 comments

Comments

@rieset
Copy link
Contributor

rieset commented Oct 17, 2021

I created a pull request #7456 to fix the method of sending the full request

But now, the following lines overriding fetchOptions, return an empty object

apollo-client/src/link/persisted-queries/index.ts/: 197

            operation.setContext({
              http: {
                includeQuery: true,
                includeExtensions: supportsPersistedQueries,
              },
              fetchOptions: {
                // Since we're including the full query, which may be
                // large, we should send it in the body of a POST request.
                // See issue #7456.
                method: 'POST',
              },
            });
            if (setFetchOptions) {
              operation.setContext({ fetchOptions: originalFetchOptions });
            }

Line 185

operation.context{{
   ...
   fetchOptions: {method: 'POST'}
}}

Line 197

setFetchOptions === true

Line 198
originalFetchOptions = {}

operation.context{{
   ...
   fetchOptions: {}
}}

As a result, full request goes via GET

I don't know why lines 197-199 are needed. But on line 198 you need to consider the method override for full requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants