1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-07 12:30:06 +00:00

fix: reverted sasjsJobExecutor no need for that

This commit is contained in:
Saad Jutt
2022-02-22 06:53:29 +05:00
parent 35f37ac796
commit d9cb2db61f
6 changed files with 23 additions and 156 deletions

View File

@@ -1,3 +1,4 @@
import * as NodeFormData from 'form-data'
import {
AuthConfig,
ExtraResponseAttributes,
@@ -108,7 +109,8 @@ export class WebJobExecutor extends BaseJobExecutor {
...this.getRequestParams(config)
}
let formData = new FormData()
let formData =
typeof FormData === 'undefined' ? new NodeFormData() : new FormData()
if (data) {
const stringifiedData = JSON.stringify(data)
@@ -143,8 +145,18 @@ export class WebJobExecutor extends BaseJobExecutor {
}
}
const contentType =
formData instanceof NodeFormData
? `multipart/form-data; boundary=${formData.getBoundary()}`
: undefined
const requestPromise = new Promise((resolve, reject) => {
this.requestClient!.post(apiUrl, formData, authConfig?.access_token)
this.requestClient!.post(
apiUrl,
formData,
authConfig?.access_token,
contentType
)
.then(async (res: any) => {
const parsedSasjsServerLog =
this.serverType === ServerType.Sasjs