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

Enable GraphiQL header editor #136

Closed
ghost opened this issue Sep 17, 2021 · 2 comments
Closed

Enable GraphiQL header editor #136

ghost opened this issue Sep 17, 2021 · 2 comments
Labels
status: superseded Issue is superseded by another

Comments

@ghost
Copy link

ghost commented Sep 17, 2021

As of graphql/graphiql#1543, GraphiQL has embedded support for editing the request headers sent to the GraphQL endpoint. However, Spring GraphQL currently does not enable the feature even though its GraphQL fetcher should support it. Sending arbitrary request headers can be useful—for example—in adapting older codebases to Spring GraphQL and providing options for how to handle authorisation.

This should add a new tab to GraphiQL, to the right of "Query variables", called "Request headers." This tab accepts a JSON payload where the keys correspond to header names and the values correspond to header values.

Enabling the GraphiQL request header editor should be easy. It should only involve updating graphql-spring-boot-starter/src/main/resources/graphiql/index.html. I've already checked out a local Spring GraphQL and implemented a proof-of-concept. If the decision is made to enable the request header, I would be willing to implement the change and send a polished pull request.

If enabling the feature for all configurations is too much, I would also support putting the feature behind a property,

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 17, 2021
@bclozel
Copy link
Member

bclozel commented Sep 17, 2021

We haven't completely made up our mind about the extent of our GraphiQL integration (see #20): should we just ship a very basic version and just update it as GraphiQL releases new versions? Should we consider an in-depth integration with a dedicated module that we build?

In any case, this sounds like a good idea - even for the default use case. Feel free to submit a PR, I can assist with a review/some polishing. This issue will be closed and superseded when your PR is created.

Thanks!

koenpunt added a commit to koenpunt/spring-graphql that referenced this issue Sep 21, 2021
koenpunt added a commit to koenpunt/spring-graphql that referenced this issue Sep 21, 2021
koenpunt added a commit to koenpunt/spring-graphql that referenced this issue Sep 21, 2021
@bclozel
Copy link
Member

bclozel commented Sep 21, 2021

Closing in favor of #142

@bclozel bclozel closed this as completed Sep 21, 2021
@bclozel bclozel added status: superseded Issue is superseded by another and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded Issue is superseded by another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants