Skip to content

Commit 3afbfee

Browse files
authored
Merge pull request graphql-java-kickstart#483 from BlasiusSecundus/feature/graphiql-header-fix
fix(graphiql): request headers not submitted with the request
2 parents 4eab2c8 + 5be62e8 commit 3afbfee

File tree

1 file changed

+9
-0
lines changed
  • graphiql-spring-boot-autoconfigure/src/main/resources

1 file changed

+9
-0
lines changed

graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@
101101

102102
var headers = ${headers}
103103

104+
function onEditHeaders(newHeaders) {
105+
try {
106+
headers = JSON.parse(newHeaders)
107+
} catch(e) {
108+
headers = {}
109+
}
110+
}
111+
104112
// Defines a GraphQL fetcher using the fetch API. You're not required to
105113
// use fetch, and could instead implement graphQLFetcher however you like,
106114
// as long as it returns a Promise or Observable.
@@ -153,6 +161,7 @@
153161
props.onEditQuery = onEditQuery
154162
props.onEditVariables = onEditVariables
155163
props.onEditOperationName = onEditOperationName
164+
props.onEditHeaders = onEditHeaders
156165

157166
console.debug(props)
158167
// Render <GraphiQL /> into the body.

0 commit comments

Comments
 (0)