mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 16:40:06 +00:00
chore(refactor): remove unnecessary variables, use jobs path from config
This commit is contained in:
@@ -28,12 +28,7 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
? config.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
|
? config.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
|
||||||
: sasJob
|
: sasJob
|
||||||
: sasJob
|
: sasJob
|
||||||
const jobUri = ''
|
let apiUrl = `${config.serverUrl}${this.jobsPath}?${'_program=' + program}`
|
||||||
let apiUrl = `${config.serverUrl}${this.jobsPath}?${
|
|
||||||
jobUri.length > 0
|
|
||||||
? '__program=' + program + '&_job=' + jobUri
|
|
||||||
: '_program=' + program
|
|
||||||
}`
|
|
||||||
apiUrl = `${apiUrl}${
|
apiUrl = `${apiUrl}${
|
||||||
config.username && config.password
|
config.username && config.password
|
||||||
? '&_username=' + config.username + '&_password=' + config.password
|
? '&_username=' + config.username + '&_password=' + config.password
|
||||||
@@ -60,7 +55,11 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.requestClient.login(config.username, config.password)
|
await this.requestClient.login(
|
||||||
|
config.username,
|
||||||
|
config.password,
|
||||||
|
this.jobsPath
|
||||||
|
)
|
||||||
const contentType =
|
const contentType =
|
||||||
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
|
||||||
@@ -81,9 +80,6 @@ export class Sas9JobExecutor extends BaseJobExecutor {
|
|||||||
const requestParams: any = {}
|
const requestParams: any = {}
|
||||||
|
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
requestParams['_omittextlog'] = 'false'
|
|
||||||
requestParams['_omitsessionresults'] = 'false'
|
|
||||||
|
|
||||||
requestParams['_debug'] = 131
|
requestParams['_debug'] = 131
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ export class Sas9RequestClient extends RequestClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async login(username: string, password: string) {
|
public async login(username: string, password: string, jobsPath: string) {
|
||||||
const codeInjectorPath = `/User Folders/${username}/My Folder/sasjs/runner`
|
const codeInjectorPath = `/User Folders/${username}/My Folder/sasjs/runner`
|
||||||
if (this.httpClient.defaults.jar) {
|
if (this.httpClient.defaults.jar) {
|
||||||
;(this.httpClient.defaults.jar as tough.CookieJar).removeAllCookies()
|
;(this.httpClient.defaults.jar as tough.CookieJar).removeAllCookies()
|
||||||
await this.get(
|
await this.get(
|
||||||
`/SASStoredProcess/do?_program=${codeInjectorPath}&_username=${username}&_password=${password}`,
|
`${jobsPath}?_program=${codeInjectorPath}&_username=${username}&_password=${password}`,
|
||||||
undefined,
|
undefined,
|
||||||
'text/plain'
|
'text/plain'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user