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 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