diff --git a/src/starlette_graphene3.py b/src/starlette_graphene3.py index 190ac23..47789ca 100644 --- a/src/starlette_graphene3.py +++ b/src/starlette_graphene3.py @@ -539,8 +539,6 @@ def _inject_file_to_operations( - - @@ -588,10 +586,11 @@ def _inject_file_to_operations( ).join('&'); // Defines a GraphQL fetcher using the fetch API. - function graphQLFetcher(graphQLParams) { + function graphQLFetcher(graphQLParams, {headers}) { var headers = { 'Accept': 'application/json', - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + ...headers, }; if (csrftoken) { headers['X-CSRFToken'] = csrftoken; @@ -640,11 +639,9 @@ def _inject_file_to_operations( function updateURL() { history.replaceState(null, null, locationQuery(parameters)); } - var subscriptionsEndpoint = (location.protocol === 'http:' ? 'ws' : 'wss') + '://' + location.host + location.pathname; - var subscriptionsClient = new window.SubscriptionsTransportWs.SubscriptionClient(subscriptionsEndpoint, { - reconnect: true - }); - var fetcher = window.GraphiQLSubscriptionsFetcher.graphQLFetcher(subscriptionsClient, graphQLFetcher); + var fetcher = window.GraphiQL.createFetcher({ + url: location.protocol + "//" + location.host + location.pathname, + }) // Render into the body. ReactDOM.render(