From 872e73b5f003f63b6d97a821a8ae2274b479b6e3 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Tue, 22 Feb 2022 17:06:27 +0500 Subject: [PATCH 1/2] fix: not to use NodeFormData function on web --- src/job-execution/WebJobExecutor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/job-execution/WebJobExecutor.ts b/src/job-execution/WebJobExecutor.ts index 1e36855..969b753 100644 --- a/src/job-execution/WebJobExecutor.ts +++ b/src/job-execution/WebJobExecutor.ts @@ -151,7 +151,7 @@ export class WebJobExecutor extends BaseJobExecutor { /* The NodeFormData object does not set the request header - so, set it */ const contentType = - formData instanceof NodeFormData + formData instanceof NodeFormData && typeof FormData === 'undefined' ? `multipart/form-data; boundary=${formData.getBoundary()}` : undefined From d3c91e143ad50de0d0b0ccf1911b735db05b6c41 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Tue, 22 Feb 2022 17:09:47 +0500 Subject: [PATCH 2/2] fix: parse empty string in res to empty {} --- src/utils/getValidJson.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/getValidJson.ts b/src/utils/getValidJson.ts index ccf903e..37229d2 100644 --- a/src/utils/getValidJson.ts +++ b/src/utils/getValidJson.ts @@ -12,6 +12,8 @@ export const getValidJson = (str: string | object): object => { if (typeof str === 'object') return str + if (str === '') return {} + return JSON.parse(str) } catch (e) { if (e instanceof JsonParseArrayError) throw e