@aloma.io/integration-sdk 3.0.14 → 3.1.0
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/build/internal/index.mjs +15 -1
- package/package.json +1 -1
- package/src/internal/index.mjs +20 -1
package/build/internal/index.mjs
CHANGED
@@ -61,7 +61,21 @@ class Fetcher {
|
|
61
61
|
const theURL = `${baseUrl?.endsWith("/") ? baseUrl : baseUrl + "/"}${url}`.replace(/\/\/+/gi, "/");
|
62
62
|
try {
|
63
63
|
await local.customize(options, args);
|
64
|
-
|
64
|
+
if (!options?.headers || !options?.headers?.Accept) {
|
65
|
+
options.headers = {
|
66
|
+
...options.headers,
|
67
|
+
Accept: 'application/json'
|
68
|
+
};
|
69
|
+
}
|
70
|
+
if (!options?.headers || !options?.headers?.['Content-type']) {
|
71
|
+
options.headers = {
|
72
|
+
...options.headers,
|
73
|
+
'Content-type': 'application/json'
|
74
|
+
};
|
75
|
+
}
|
76
|
+
if (!(options?.method === 'GET' || options?.method === 'HEAD') && options?.body && !(typeof (options.body) === 'string') && options?.headers?.['Content-type'] === 'application/json') {
|
77
|
+
options.body = JSON.stringify(options.body);
|
78
|
+
}
|
65
79
|
const ret = await fetch(theURL, options);
|
66
80
|
const status = await ret.status;
|
67
81
|
if (status > 399) {
|
package/package.json
CHANGED
package/src/internal/index.mjs
CHANGED
@@ -79,7 +79,26 @@ class Fetcher {
|
|
79
79
|
try {
|
80
80
|
await local.customize(options, args);
|
81
81
|
|
82
|
-
|
82
|
+
if (!options?.headers || !options?.headers?.Accept)
|
83
|
+
{
|
84
|
+
options.headers = {
|
85
|
+
...options.headers,
|
86
|
+
Accept: 'application/json'
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
if (!options?.headers || !options?.headers?.['Content-type'])
|
91
|
+
{
|
92
|
+
options.headers = {
|
93
|
+
...options.headers,
|
94
|
+
'Content-type': 'application/json'
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
if (!(options?.method === 'GET' || options?.method === 'HEAD') && options?.body && !(typeof(options.body) === 'string') && options?.headers?.['Content-type'] === 'application/json')
|
99
|
+
{
|
100
|
+
options.body = JSON.stringify(options.body)
|
101
|
+
}
|
83
102
|
|
84
103
|
const ret = await fetch(theURL, options);
|
85
104
|
const status = await ret.status;
|