|
61 | 61 | var fetchURL = locationQuery(otherParams);
|
62 | 62 |
|
63 | 63 | // Defines a GraphQL fetcher using the fetch API.
|
64 |
| - function httpClient(graphQLParams) { |
65 |
| - var headers = { |
66 |
| - Accept: "application/json", |
67 |
| - "Content-Type": "application/json", |
68 |
| - }; |
| 64 | + function httpClient(graphQLParams, opts) { |
| 65 | + if (typeof opts === 'undefined') { |
| 66 | + opts = {}; |
| 67 | + } |
| 68 | + var headers = opts.headers || {}; |
| 69 | + headers['Accept'] = headers['Accept'] || 'application/json'; |
| 70 | + headers['Content-Type'] = headers['Content-Type'] || 'application/json'; |
69 | 71 | if (csrftoken) {
|
70 |
| - headers["X-CSRFToken"] = csrftoken; |
| 72 | + headers['X-CSRFToken'] = csrftoken |
71 | 73 | }
|
72 | 74 | return fetch(fetchURL, {
|
73 | 75 | method: "post",
|
|
108 | 110 | var activeSubscription = null;
|
109 | 111 |
|
110 | 112 | // Define a GraphQL fetcher that can intelligently route queries based on the operation type.
|
111 |
| - function graphQLFetcher(graphQLParams) { |
| 113 | + function graphQLFetcher(graphQLParams, opts) { |
112 | 114 | var operationType = getOperationType(graphQLParams);
|
113 | 115 |
|
114 | 116 | // If we're about to execute a new operation, and we have an active subscription,
|
|
126 | 128 | },
|
127 | 129 | };
|
128 | 130 | } else {
|
129 |
| - return httpClient(graphQLParams); |
| 131 | + return httpClient(graphQLParams, opts); |
130 | 132 | }
|
131 | 133 | }
|
132 | 134 |
|
|
173 | 175 | onEditQuery: onEditQuery,
|
174 | 176 | onEditVariables: onEditVariables,
|
175 | 177 | onEditOperationName: onEditOperationName,
|
| 178 | + headerEditorEnabled: GRAPHENE_SETTINGS.graphiqlHeaderEditorEnabled, |
176 | 179 | query: parameters.query,
|
177 | 180 | };
|
178 | 181 | if (parameters.variables) {
|
|
0 commit comments