@digipair/skill-http 0.23.7 → 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 +4 -3
- package/index.esm.js +4 -3
- package/package.json +1 -1
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
|
|
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
|
|
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;
|