diff --git a/client/fetch/index.ts b/client/fetch/index.ts index 9292c93..3a65253 100644 --- a/client/fetch/index.ts +++ b/client/fetch/index.ts @@ -48,6 +48,8 @@ export default async function fetchApi< let fetchOptions: RequestInit = {}; try { + fetchOptions.method = options.method; + if (options.method.match(/post|put|delete|patch/i)) { if (options.body && typeof options.body == "object") { fetchOptions.body = JSON.stringify(options.body); @@ -56,6 +58,8 @@ export default async function fetchApi< fetchOptions.headers = _.merge(finalHeaders, options.headers || {}); + fetchOptions = _.merge(fetchOptions, options.fetchOptions); + fetchData = await fetch(url, fetchOptions); data = fetchData.json(); } catch (error: any) { diff --git a/dist/client/fetch/index.js b/dist/client/fetch/index.js index 418452a..256f9b5 100644 --- a/dist/client/fetch/index.js +++ b/dist/client/fetch/index.js @@ -52,12 +52,14 @@ function fetchApi(url, options) { let fetchData; let fetchOptions = {}; try { + fetchOptions.method = options.method; if (options.method.match(/post|put|delete|patch/i)) { if (options.body && typeof options.body == "object") { fetchOptions.body = JSON.stringify(options.body); } } fetchOptions.headers = lodash_1.default.merge(finalHeaders, options.headers || {}); + fetchOptions = lodash_1.default.merge(fetchOptions, options.fetchOptions); fetchData = yield fetch(url, fetchOptions); data = fetchData.json(); } diff --git a/package.json b/package.json index 2dec1a0..689913b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "5.7.13", + "version": "5.7.14", "description": "Cloud-based SQL data management tool", "main": "dist/index.js", "bin": {