@cuppet/core 1.1.0 → 1.1.2
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/package.json +1 -1
- package/src/apiFunctions.js +4 -9
package/package.json
CHANGED
package/src/apiFunctions.js
CHANGED
|
@@ -12,8 +12,6 @@ module.exports = {
|
|
|
12
12
|
response: null,
|
|
13
13
|
/** @type {object} */
|
|
14
14
|
request: null,
|
|
15
|
-
/** @type {object} */
|
|
16
|
-
formData: null,
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Prepare path for API test usage
|
|
@@ -45,9 +43,9 @@ module.exports = {
|
|
|
45
43
|
'Content-Type': 'application/json',
|
|
46
44
|
Accept: 'application/json',
|
|
47
45
|
};
|
|
48
|
-
if (this.
|
|
46
|
+
if (this.request instanceof FormData) {
|
|
49
47
|
defaultHeaders = {};
|
|
50
|
-
Object.assign(defaultHeaders, this.
|
|
48
|
+
Object.assign(defaultHeaders, this.request.getHeaders());
|
|
51
49
|
}
|
|
52
50
|
if (config.has('api.x-api-key')) {
|
|
53
51
|
defaultHeaders['X-Api-Key'] = config.get('api.x-api-key');
|
|
@@ -106,9 +104,6 @@ module.exports = {
|
|
|
106
104
|
if (this.request) {
|
|
107
105
|
data = this.request;
|
|
108
106
|
}
|
|
109
|
-
if (this.formData) {
|
|
110
|
-
data = this.formData;
|
|
111
|
-
}
|
|
112
107
|
try {
|
|
113
108
|
this.response = await axios.request({
|
|
114
109
|
url: apiUrl,
|
|
@@ -316,7 +311,7 @@ module.exports = {
|
|
|
316
311
|
formData.append(key, await storage.checkForSavedVariable(value));
|
|
317
312
|
}
|
|
318
313
|
}
|
|
319
|
-
this.
|
|
320
|
-
return this.
|
|
314
|
+
this.request = formData;
|
|
315
|
+
return this.request;
|
|
321
316
|
},
|
|
322
317
|
};
|