From bd03b2b06d91f79f999bf27db252ce09478236d6 Mon Sep 17 00:00:00 2001 From: sabhas Date: Sun, 15 Aug 2021 16:11:50 +0500 Subject: [PATCH] fix: when contextName is falsy value, do not add it to apiUrl in web approach and fallback to default in jes approach --- src/SASjs.ts | 5 +++++ src/job-execution/WebJobExecutor.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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 = {