Skip to content

Commit

Permalink
fix json parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed May 8, 2023
1 parent ba4fc66 commit 83abc61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions CommonServer/Types/Workflow/Components/API/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,9 @@ export class ApiComponentUtils {
}

if (args['request-body'] && typeof args['request-body'] === 'string') {
console.log('here');

console.log(args['request-body']);
args['request-body'] = JSONFunctions.parse(
`${args['request-body'] as string}`
);

console.log(args['request-body']);
}

if (
Expand Down
12 changes: 6 additions & 6 deletions Workflow/Services/RunWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,13 @@ export default class RunWorkflow {
// pick arguments from storage map.
const argumentObj: JSONObject = {};


const serializeValueForJSON: Function = (value: string): string => {

if(!value){
if (!value) {
return value;
}

return value.replace(/\n/g, '\\n')
}
return value.replace(/\n/g, '\\n');
};

const deepFind: Function = (
obj: JSONObject,
Expand Down Expand Up @@ -448,7 +446,9 @@ export default class RunWorkflow {
} else {
argumentContentCopy = argumentContentCopy.replace(
'{{' + variable + '}}',
argument.type === ComponentInputType.JSON ? serializeValueForJSON(value) : `${value}`
argument.type === ComponentInputType.JSON
? serializeValueForJSON(value)
: `${value}`
);
}
}
Expand Down

0 comments on commit 83abc61

Please sign in to comment.