warrenday / graphql-network-inspector

A better network inspector for viewing and debugging GraphQL requests.
MIT License
485 stars 47 forks source link

Persisted Query `operationName` not displayed when using GET request #148

Closed gthau closed 1 week ago

gthau commented 3 weeks ago

Describe the bug Graphql servers, such as Graphql Yoga, supports requests received through POST and GET. On the client-side, if using Apollo Client, one can use the Persisted Query Link which has a param useGETForHashedQueries to make persisted queries using GET.

Currently Graphql Network Inspector supports POST and GET requests and Persisted Queries, but for Persisted Queries, the operationName is correctly displayed only when the request is made using POST method.

To Reproduce

  1. make a POST request and the operationName and extensions in request body
  2. in Graphql Network Inspector, the Query/Mutation column displays "P myPersistedQuery"
  3. try the same persisted operation using GET method and passing operationName and extensions in query parameters instead of request's body, e.g. `http://example.com/graphql?operationName=myPersistedQuery&extensions=......
  4. in Graphql Network Inspector, the Query/Mutation column displays "P Persisted Query" instead of "P myPersistedQuery"

Expected behavior Same as POST requests, the inspector should extract the operationName and display it

Screenshots

persistedqueries_operationname_missing

Desktop (please complete the following information):

I submitted PR https://github.com/warrenday/graphql-network-inspector/pull/149 to fix this issue.

warrenday commented 1 week ago

Will now close this issue given @gthau has added a fix, now merged.