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

Integrate graphiql's support of headers in the explorer #1392

Open
jasonawant opened this issue Mar 22, 2024 · 0 comments
Open

Integrate graphiql's support of headers in the explorer #1392

jasonawant opened this issue Mar 22, 2024 · 0 comments

Comments

@jasonawant
Copy link

It appears that within Drupal.behaviors.graphQLRenderExplorer here, the fetch request does not use the graphiql supported explorer headers.

It looks like the fetch assigns its own headers.

    // Defines a GraphQL fetcher using the fetch API.
    const graphQLFetcher = graphQLParams => fetch(settings.graphqlRequestUrl, {
      method: 'post',
      credentials: 'same-origin',
      body: JSON.stringify(graphQLParams),
      headers: {
        'Content-Type': 'application/json',
      },
    }).then(response => response.json());

graphiql supports sending custom request headers through its UI as seen in the screen shot below.
image

Am I looking at this correctly?

It would be sweet to send custom request headers, e.g. Authorization bearer tokens with the request.

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

No branches or pull requests

1 participant