nuxt-graphql-middleware 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.mjs CHANGED
@@ -90,7 +90,7 @@ function createServerMiddleware(graphqlServer, queries, mutations, config) {
90
90
  const headers = buildHeaders(req, name, "mutation", config);
91
91
  const endpoint = getEndpoint(req);
92
92
  const client = getClient(endpoint);
93
- const response = await client.request(mutation, req.body, headers);
93
+ const response = await client.rawRequest(mutation, req.body, headers);
94
94
  if (config?.onMutationResponse) {
95
95
  return config.onMutationResponse(response, req, res);
96
96
  }
package/dist/plugin.mjs CHANGED
@@ -73,7 +73,7 @@ class GraphqlMiddlewarePlugin {
73
73
  const params = new URLSearchParams({
74
74
  name
75
75
  });
76
- let defaultOptions = {
76
+ let fetchOptions = {
77
77
  method: "POST",
78
78
  credentials: "include",
79
79
  headers: {
@@ -84,9 +84,10 @@ class GraphqlMiddlewarePlugin {
84
84
  },
85
85
  body: JSON.stringify(variables)
86
86
  };
87
- return this.doBeforeRequest(defaultOptions).then((fetchOptions) => {
88
- return fetch(this.baseURL + "/mutate?" + params.toString(), fetchOptions).then((response) => response.json());
89
- });
87
+ if (this.beforeRequestFn) {
88
+ fetchOptions = this.beforeRequestFn(this.context, fetchOptions);
89
+ }
90
+ return fetch(this.baseURL + "/mutate?" + params.toString(), fetchOptions).then((response) => response.json());
90
91
  }
91
92
  }
92
93
  const graphqlMiddlewarePlugin = (context, inject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Module to perform GraphQL requests as a server middleware.",
5
5
  "repository": {
6
6
  "type": "git",