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

[graphiql] Setting defaultHeaders causes TypeError: doc.iter is not a function #3870

Open
1 task done
netcoding87 opened this issue Feb 27, 2025 · 1 comment
Open
1 task done

Comments

@netcoding87
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Creating an example based on Unpkg (CDN), I want to add defaultHeaders additionally doing it so:

...
root.render(
      React.createElement(GraphiQL, {
        fetcher,
        defaultEditorToolsVisibility: true,
        defaultHeaders: { 'foo': 'bar' },
        plugins: [explorerPlugin],
      }),
    );

When loading the page I get this on the console:

Image

Expected Behavior

Page loads with default Headers set.

Steps To Reproduce

Open https://codesandbox.io/p/sandbox/7my5dd
See console output

Environment

  • GraphiQL Version:
  • OS:
  • Browser:
  • Bundler:
  • react Version:
  • graphql Version:

Anything else?

No response

@netcoding87 netcoding87 changed the title [graphiql] Setting defaultHeaders causes TypeError: doc.iter is not a function [graphiql] Setting defaultHeaders causes TypeError: doc.iter is not a function Feb 28, 2025
@acao
Copy link
Member

acao commented Feb 28, 2025

@netcoding87 I will check into this when I get a chance, but I think this is supposed to be a string instead of an object! Either way we should supply some runtime duck typing to make this more obvious for non TS users

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