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

Commit 08c8c98

Browse files
Fix sending of custom headers (#674)
Fixes #672
1 parent c5aa7a1 commit 08c8c98

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/renderGraphiQL.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,16 @@ add "&raw" to the end of the URL within a browser.
143143
var fetchURL = locationQuery(otherParams);
144144
145145
// Defines a GraphQL fetcher using the fetch API.
146-
function graphQLFetcher(graphQLParams) {
146+
function graphQLFetcher(graphQLParams, opts) {
147147
return fetch(fetchURL, {
148148
method: 'post',
149-
headers: {
150-
'Accept': 'application/json',
151-
'Content-Type': 'application/json'
152-
},
149+
headers: Object.assign(
150+
{
151+
'Accept': 'application/json',
152+
'Content-Type': 'application/json'
153+
},
154+
opts && opts.headers,
155+
),
153156
body: JSON.stringify(graphQLParams),
154157
credentials: 'include',
155158
}).then(function (response) {

0 commit comments

Comments
 (0)