mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-17 09:00:06 +00:00
fix: Sas9JobExecutor appendRequest
This commit is contained in:
@@ -1044,6 +1044,7 @@ export default class SASjs {
|
|||||||
this.sasjsConfig.serverUrl,
|
this.sasjsConfig.serverUrl,
|
||||||
this.sasjsConfig.serverType!,
|
this.sasjsConfig.serverType!,
|
||||||
this.jobsPath,
|
this.jobsPath,
|
||||||
|
this.requestClient,
|
||||||
this.sasjsConfig.httpsAgentOptions
|
this.sasjsConfig.httpsAgentOptions
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ErrorResponse } from '../types/errors'
|
|||||||
import { convertToCSV, isRelativePath } from '../utils'
|
import { convertToCSV, isRelativePath } from '../utils'
|
||||||
import { BaseJobExecutor } from './JobExecutor'
|
import { BaseJobExecutor } from './JobExecutor'
|
||||||
import { Sas9RequestClient } from '../request/Sas9RequestClient'
|
import { Sas9RequestClient } from '../request/Sas9RequestClient'
|
||||||
|
import { RequestClient } from '../request/RequestClient'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job executor for SAS9 servers for use in Node.js environments.
|
* Job executor for SAS9 servers for use in Node.js environments.
|
||||||
@@ -18,6 +19,7 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
serverUrl: string,
|
serverUrl: string,
|
||||||
serverType: ServerType,
|
serverType: ServerType,
|
||||||
private jobsPath: string,
|
private jobsPath: string,
|
||||||
|
private requestClientSingle: RequestClient,
|
||||||
httpsAgentOptions?: https.AgentOptions
|
httpsAgentOptions?: https.AgentOptions
|
||||||
) {
|
) {
|
||||||
super(serverUrl, serverType)
|
super(serverUrl, serverType)
|
||||||
@@ -37,6 +39,8 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
: ''
|
: ''
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
apiUrl = `${apiUrl}${config.debug ? '&_debug=131' : ''}`
|
||||||
|
|
||||||
let requestParams = {
|
let requestParams = {
|
||||||
...this.getRequestParams(config)
|
...this.getRequestParams(config)
|
||||||
}
|
}
|
||||||
@@ -66,6 +70,7 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
data && Object.keys(data).length
|
data && Object.keys(data).length
|
||||||
? 'multipart/form-data; boundary=' + (formData as any)._boundary
|
? 'multipart/form-data; boundary=' + (formData as any)._boundary
|
||||||
: 'text/plain'
|
: 'text/plain'
|
||||||
|
|
||||||
return await this.requestClient!.post(
|
return await this.requestClient!.post(
|
||||||
apiUrl,
|
apiUrl,
|
||||||
formData,
|
formData,
|
||||||
@@ -76,6 +81,24 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
Connection: 'Keep-Alive'
|
Connection: 'Keep-Alive'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
.then((res: any) => {
|
||||||
|
let resString = res
|
||||||
|
|
||||||
|
if (typeof res === 'object') {
|
||||||
|
resString = JSON.stringify(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.requestClientSingle!.appendRequest(resString, sasJob, config.debug)
|
||||||
|
})
|
||||||
|
.catch((err: any) => {
|
||||||
|
let errString = err
|
||||||
|
|
||||||
|
if (typeof err === 'object') {
|
||||||
|
errString = JSON.stringify(errString)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.requestClientSingle!.appendRequest(errString, sasJob, config.debug)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRequestParams(config: any): any {
|
private getRequestParams(config: any): any {
|
||||||
|
|||||||
Reference in New Issue
Block a user