Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Upgrade Graphiql to enable headers #441

Closed
timothyschu opened this issue Jul 11, 2020 · 5 comments · Fixed by #484
Closed

Upgrade Graphiql to enable headers #441

timothyschu opened this issue Jul 11, 2020 · 5 comments · Fixed by #484
Milestone

Comments

@timothyschu
Copy link

Is your feature request related to a problem? Please describe.
Currently, the GraphiQL SpringBoot starter does not support adding dynamic headers.

Describe the solution you'd like
With the newest version of GraphiQL, a new tab was added which allows for dynamic headers. graphql-spring-boot should use that latest version. See the GraphiQL issue provided under additional context.

Describe alternatives you've considered
The alternative is to set the header in the application config, but this is a static header. Changing headers requires a restart.

Additional context
graphql/graphiql#59

@kyle-wang-sd
Copy link

It's finally resoved by graphql/graphiql#1543, this is good.
But the whole process to apply this feature really really sucks, it have been 5 years since we want this feature.

@oliemansm
Copy link
Member

We welcome PRs if anybody has the time to implement this.

@oliemansm oliemansm added this to the 8.1.0 milestone Nov 18, 2020
@oliemansm
Copy link
Member

oliemansm commented Nov 18, 2020

I've upgraded GraphiQL to 1.0.6. Will be available in release 8.1.0. To enable the headers you can add the following application property:

graphiql:
  props:
    variables:
      headerEditorEnabled: true

Just like you can configure any of the GraphiQL Props under the graphiql.props.variables group.

BlasiusSecundus added a commit to BlasiusSecundus/graphql-spring-boot that referenced this issue Nov 25, 2020
Although the headers editor was present (graphql-java-kickstart#441), it was non-functional
because only the preconfigured headers were submitted, regardless of the
content of the request headers tab.
BlasiusSecundus added a commit to BlasiusSecundus/graphql-spring-boot that referenced this issue Nov 25, 2020
Although the headers editor was present (graphql-java-kickstart#441), it was non-functional
because only the preconfigured headers were submitted, regardless of the
content of the request headers tab.
@BlasiusSecundus
Copy link

Apart of the issue addressed in the PR above, I noticed several issues with the header configuration:

  • headers configured in graphiql.headers are not present in the "Request headers" tab, but are sent with the request (assuming the content of the tab was not edited)
  • headers configured in graphiql.props.variables.headers are present in the "Request headers" tab, but are not sent with the request (unless a content change event is triggered)
  • if both are configured the content of graphiql.headers is submitted but the content of graphiql.props.variables.headers is displayed

@oliemansm Since this is an unreleased feature, I am not sure if a new issue should be raised or this one should be reopened.

@craigmit
Copy link

craigmit commented Feb 19, 2021

I've upgraded GraphiQL to 1.0.6. Will be available in release 8.1.0. To enable the headers you can add the following application property:

graphiql:
  props:
    variables:
      headerEditorEnabled: true

Just like you can configure any of the GraphiQL Props under the graphiql.props.variables group.

Note: You'll get an error about trying to convert a boolean to a string if you're running an old version of com.fasterxml.jackson.core.

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

Successfully merging a pull request may close this issue.

5 participants