@digipair/skill-http 0.23.6 → 0.23.8

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/index.cjs.js CHANGED
@@ -18,13 +18,14 @@ let HttpService = class HttpService {
18
18
  const response = await fetch(url, {
19
19
  method,
20
20
  headers: _extends({
21
- Accept: 'application/json',
21
+ Accept: this.IS_JSON ? 'application/json' : '*/*'
22
+ }, data ? {
22
23
  'Content-Type': 'application/json'
23
- }, headers),
24
+ } : {}, headers),
24
25
  body: data ? this.IS_JSON ? JSON.stringify(data) : data : undefined
25
26
  });
26
27
  if (!response.ok) throw new Error('[SKILL-HTTP] REQUEST FAILED: ' + response.status);
27
- return await this.IS_JSON ? response.json() : response.text();
28
+ return this.IS_JSON ? response.json() : response.text();
28
29
  }
29
30
  async create(params, _pinsSettingsList, _context) {
30
31
  const { path, body = {}, headers = {} } = params;
package/index.esm.js CHANGED
@@ -14,13 +14,14 @@ let HttpService = class HttpService {
14
14
  const response = await fetch(url, {
15
15
  method,
16
16
  headers: _extends({
17
- Accept: 'application/json',
17
+ Accept: this.IS_JSON ? 'application/json' : '*/*'
18
+ }, data ? {
18
19
  'Content-Type': 'application/json'
19
- }, headers),
20
+ } : {}, headers),
20
21
  body: data ? this.IS_JSON ? JSON.stringify(data) : data : undefined
21
22
  });
22
23
  if (!response.ok) throw new Error('[SKILL-HTTP] REQUEST FAILED: ' + response.status);
23
- return await this.IS_JSON ? response.json() : response.text();
24
+ return this.IS_JSON ? response.json() : response.text();
24
25
  }
25
26
  async create(params, _pinsSettingsList, _context) {
26
27
  const { path, body = {}, headers = {} } = params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-http",
3
- "version": "0.23.6",
3
+ "version": "0.23.8",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"