Skip to content

Fix bad introspection result for an endpoint URL string #2894

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ianc-flwls
Copy link

Description

This PR Fixes #2876 where the printSchemaFromEndpoint function is assuming the server will serve back JSON regardless of headers.
If a user passed a URL for a graphql endpoint to the github action, and headers are a requirement to determine the response (particularly when assuming the response is JSON) then the endpoint will respond with unsupported content type.

This change updates the headers sent as part of the fetch request to request the content-type to be JSON if it hasn't been provided as part of an Endpoint.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)

Screenshots/Sandbox (if appropriate/relevant):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take
action on it as appropriate

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can
reproduce. Please also list any relevant details for your test configuration

See: https://github.com/graphql-hive/graphql-inspector/compare/master...ianc-flwls:graphql-inspector:fix-2876-bad-data-response?expand=1#diff-f4ab9ab13ff697781f89b03a3bc415887db2fab4f9181fefd210e7cf4ded1d02

Test Environment:
I ran pnpm run test

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ianc-flwls ianc-flwls force-pushed the fix-2876-bad-data-response branch from 4fa4b8c to 8f0ed2e Compare July 8, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant