mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-10 13:50:05 +00:00
Merge pull request #655 from sasjs/node-form-data-fix
fix: not to use NodeFormData function on web
This commit is contained in:
@@ -151,7 +151,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
|
|
||||||
/* The NodeFormData object does not set the request header - so, set it */
|
/* The NodeFormData object does not set the request header - so, set it */
|
||||||
const contentType =
|
const contentType =
|
||||||
formData instanceof NodeFormData
|
formData instanceof NodeFormData && typeof FormData === 'undefined'
|
||||||
? `multipart/form-data; boundary=${formData.getBoundary()}`
|
? `multipart/form-data; boundary=${formData.getBoundary()}`
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ export const getValidJson = (str: string | object): object => {
|
|||||||
|
|
||||||
if (typeof str === 'object') return str
|
if (typeof str === 'object') return str
|
||||||
|
|
||||||
|
if (str === '') return {}
|
||||||
|
|
||||||
return JSON.parse(str)
|
return JSON.parse(str)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof JsonParseArrayError) throw e
|
if (e instanceof JsonParseArrayError) throw e
|
||||||
|
|||||||
Reference in New Issue
Block a user