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

Commit d7d2ee6

Browse files
committed
Add support for two graphiql headers configurations
fix #441
1 parent 3afbfee commit d7d2ee6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

example/src/main/resources/application.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ altair:
2525
graphiql:
2626
enabled: true
2727
cdn:
28-
enabled: true
28+
enabled: false
2929
version: 0.17.5
30+
headers:
31+
Test: TestHeader
32+
props:
33+
variables:
34+
headerEditorEnabled: true
35+
headers: '{ "Authorization": "SomeValue" }'
3036
voyager:
3137
enabled: true
3238
cdn:

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,12 @@
162162
props.onEditVariables = onEditVariables
163163
props.onEditOperationName = onEditOperationName
164164
props.onEditHeaders = onEditHeaders
165+
props.headers = props.headers || {}
166+
if (headers) {
167+
var newHeaders = Object.assign({}, JSON.parse(props.headers), headers)
168+
props.headers = JSON.stringify(newHeaders, undefined, 2)
169+
}
165170

166-
console.debug(props)
167171
// Render <GraphiQL /> into the body.
168172
ReactDOM.render(
169173
React.createElement(GraphiQL, props),

0 commit comments

Comments
 (0)