diff --git a/src/SASjs.ts b/src/SASjs.ts index 015007b..5924985 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -619,6 +619,11 @@ export default class SASjs { authConfig ) } else { + if (!config.contextName) + config = { + ...config, + contextName: 'SAS Job Execution compute context' + } return await this.jesJobExecutor!.execute( sasJob, data, diff --git a/src/job-execution/WebJobExecutor.ts b/src/job-execution/WebJobExecutor.ts index 98063fa..c75a06e 100644 --- a/src/job-execution/WebJobExecutor.ts +++ b/src/job-execution/WebJobExecutor.ts @@ -54,7 +54,12 @@ export class WebJobExecutor extends BaseJobExecutor { apiUrl += jobUri.length > 0 ? '&_job=' + jobUri : '' - apiUrl += config.contextName ? `&_contextname=${config.contextName}` : '' + // if context name exists and is not blank string + // then add _contextname variable in apiUrl + apiUrl += + config.contextName && !/\s/.test(config.contextName) + ? `&_contextname=${config.contextName}` + : '' } let requestParams = {