warrenday / graphql-network-inspector

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

Does not detect compressed requests #142

Closed denis-sokolov closed 3 weeks ago

denis-sokolov commented 2 months ago

Describe the bug The extension does not recognize GraphQL requests if they have been sent with an HTTP encoding (namely, “deflate” or “gzip” compression).

To Reproduce

  1. Open the interactive demo.
  2. Open the developer tools.
  3. Press on both buttons.
  4. Notice how extension shows only one GraphQL request.

Expected behavior Expected to see two GraphQL requests.

Notice that both requests worked the same way and showed up in the console and the browser’s network tab.

Additional context Relevant code in the repo: https://github.com/warrenday/graphql-network-inspector/blob/22e1393ab598e40575734a6850b426217812e9c7/src/helpers/networkHelpers.ts#L267-L270

It seems we need to recognize popular Content-Encoding header values (deflate and gzip) and decode the HTTP body before detecting GraphQL queries in it.

warrenday commented 4 weeks ago

Thanks for adding the interactive demo, it's been super helpful in getting this feature working. I'll be releasing an update in a couple days.

warrenday commented 3 weeks ago

2.21.4 has no been released with the patch to handle compressed queries.

The demo is now working:

Screenshot 2024-09-06 at 09 04 02

Thanks for raising and putting the demo together. Completely new to the native streaming/compression API's so this was a fun one to work on.