From 5be62e82e1edc9a6ed7c6e3114c516ea061cfc41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Vajner?= Date: Tue, 24 Nov 2020 23:28:42 +0100 Subject: [PATCH] fix(graphiql): request headers not submitted with the request Although the headers editor was present (#441), it was non-functional because only the preconfigured headers were submitted, regardless of the content of the request headers tab. --- .../src/main/resources/graphiql.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html b/graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html index 7fe26368..c45fa978 100644 --- a/graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html +++ b/graphiql-spring-boot-autoconfigure/src/main/resources/graphiql.html @@ -101,6 +101,14 @@ var headers = ${headers} + function onEditHeaders(newHeaders) { + try { + headers = JSON.parse(newHeaders) + } catch(e) { + headers = {} + } + } + // Defines a GraphQL fetcher using the fetch API. You're not required to // use fetch, and could instead implement graphQLFetcher however you like, // as long as it returns a Promise or Observable. @@ -153,6 +161,7 @@ props.onEditQuery = onEditQuery props.onEditVariables = onEditVariables props.onEditOperationName = onEditOperationName + props.onEditHeaders = onEditHeaders console.debug(props) // Render into the body.