Enable GraphiQL header editor
This commit enables a new tab in the GraphiQL UI that allows editing request headers. Closes gh-142
This commit is contained in:
@@ -61,11 +61,12 @@
|
||||
></script>
|
||||
<script>
|
||||
function graphQLFetcher(path) {
|
||||
return graphQLParams => fetch(
|
||||
return (graphQLParams, options = {}) => fetch(
|
||||
`${location.protocol}//${location.host}${path}`,
|
||||
{
|
||||
method: 'post',
|
||||
headers: {
|
||||
...options.headers,
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
@@ -86,6 +87,7 @@
|
||||
React.createElement(GraphiQL, {
|
||||
fetcher: gqlFetcher,
|
||||
defaultVariableEditorOpen: true,
|
||||
headerEditorEnabled: true
|
||||
}),
|
||||
document.getElementById('graphiql'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user