Skip to content

Commit 5be62e8

Browse files
fix(graphiql): request headers not submitted with the request
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.
1 parent 4eab2c8 commit 5be62e8

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)