ws-process 0.3.31 → 0.3.33
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.js +13 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -457,6 +457,17 @@ function handleResponseHandler(res, getState, isLast = true, isFirst = true) {
|
|
|
457
457
|
return { cbData };
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
+
function stringifyParams(params) {
|
|
461
|
+
if (!params) {
|
|
462
|
+
return params;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return Object.keys(params).reduce((acc, key) => {
|
|
466
|
+
acc[key] = tryit(() => JSON.stringify(params[key]), params[key]);
|
|
467
|
+
return acc;
|
|
468
|
+
}, {});
|
|
469
|
+
}
|
|
470
|
+
|
|
460
471
|
function asyncSend(msg) {
|
|
461
472
|
return (dispatch, getState) => {
|
|
462
473
|
// eslint-disable-next-line consistent-return
|
|
@@ -531,7 +542,7 @@ function asyncSend(msg) {
|
|
|
531
542
|
const httpMSG = removeUndefinedKeys({
|
|
532
543
|
url,
|
|
533
544
|
method: msg.method,
|
|
534
|
-
params: defined(msg.params, msg.method === 'GET' ? msg.body : undefined),
|
|
545
|
+
params: defined(msg.params, msg.method === 'GET' ? stringifyParams(msg.body) : undefined),
|
|
535
546
|
data: defined(msg.data, msg.method !== 'GET' ? msg.body : undefined),
|
|
536
547
|
headers: {
|
|
537
548
|
...msg.headers,
|
|
@@ -1038,7 +1049,7 @@ function runProcess(processID, data) {
|
|
|
1038
1049
|
: prcItem.reqParameters;
|
|
1039
1050
|
if (!reqParameters) {
|
|
1040
1051
|
local.afterEachProcess(prc, local.wsProcess.processes);
|
|
1041
|
-
prc.reject('No request to send, process is stopped');
|
|
1052
|
+
prc.reject({ requestIsFalsy: true, message: 'No request to send, process is stopped' });
|
|
1042
1053
|
wrapClearWSProcess(processID);
|
|
1043
1054
|
return;
|
|
1044
1055
|
}
|