mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 19:44:35 +00:00
fix: add a new variable _SASJS_WEBOUT_HEADERS to code.js and code.py
This commit is contained in:
@@ -89,6 +89,8 @@ export class ExecutionController {
|
|||||||
tokenFile,
|
tokenFile,
|
||||||
preProgramVariables?.httpHeaders.join('\n') ?? ''
|
preProgramVariables?.httpHeaders.join('\n') ?? ''
|
||||||
)
|
)
|
||||||
|
if (returnJson)
|
||||||
|
await createFile(headersPath, 'Content-type: application/json')
|
||||||
|
|
||||||
await processProgram(
|
await processProgram(
|
||||||
program,
|
program,
|
||||||
@@ -96,6 +98,7 @@ export class ExecutionController {
|
|||||||
vars,
|
vars,
|
||||||
session,
|
session,
|
||||||
weboutPath,
|
weboutPath,
|
||||||
|
headersPath,
|
||||||
tokenFile,
|
tokenFile,
|
||||||
runTime,
|
runTime,
|
||||||
logPath,
|
logPath,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export const createJSProgram = async (
|
|||||||
vars: ExecutionVars,
|
vars: ExecutionVars,
|
||||||
session: Session,
|
session: Session,
|
||||||
weboutPath: string,
|
weboutPath: string,
|
||||||
|
headersPath: string,
|
||||||
tokenFile: string,
|
tokenFile: string,
|
||||||
otherArgs?: any
|
otherArgs?: any
|
||||||
) => {
|
) => {
|
||||||
@@ -23,15 +24,16 @@ let _webout = '';
|
|||||||
const weboutPath = '${
|
const weboutPath = '${
|
||||||
isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath
|
isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath
|
||||||
}';
|
}';
|
||||||
const _sasjs_tokenfile = '${
|
const _SASJS_TOKENFILE = '${
|
||||||
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
|
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
|
||||||
}';
|
}';
|
||||||
const _sasjs_username = '${preProgramVariables?.username}';
|
const _SASJS_WEBOUT_HEADERS = '${headersPath}';
|
||||||
const _sasjs_userid = '${preProgramVariables?.userId}';
|
const _SASJS_USERNAME = '${preProgramVariables?.username}';
|
||||||
const _sasjs_displayname = '${preProgramVariables?.displayName}';
|
const _SASJS_USERID = '${preProgramVariables?.userId}';
|
||||||
const _metaperson = _sasjs_displayname;
|
const _SASJS_DISPLAYNAME = '${preProgramVariables?.displayName}';
|
||||||
const _metauser = _sasjs_username;
|
const _METAPERSON = _SASJS_DISPLAYNAME;
|
||||||
const sasjsprocessmode = 'Stored Program';
|
const _METAUSER = _SASJS_USERNAME;
|
||||||
|
const SASJSPROCESSMODE = 'Stored Program';
|
||||||
`
|
`
|
||||||
|
|
||||||
const requiredModules = `const fs = require('fs')`
|
const requiredModules = `const fs = require('fs')`
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export const createPythonProgram = async (
|
|||||||
vars: ExecutionVars,
|
vars: ExecutionVars,
|
||||||
session: Session,
|
session: Session,
|
||||||
weboutPath: string,
|
weboutPath: string,
|
||||||
|
headersPath: string,
|
||||||
tokenFile: string,
|
tokenFile: string,
|
||||||
otherArgs?: any
|
otherArgs?: any
|
||||||
) => {
|
) => {
|
||||||
@@ -22,6 +23,7 @@ _SASJS_SESSION_PATH = '${
|
|||||||
isWindows() ? session.path.replace(/\\/g, '\\\\') : session.path
|
isWindows() ? session.path.replace(/\\/g, '\\\\') : session.path
|
||||||
}';
|
}';
|
||||||
_WEBOUT = '${isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath}';
|
_WEBOUT = '${isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath}';
|
||||||
|
_SASJS_WEBOUT_HEADERS = '${headersPath}';
|
||||||
_SASJS_TOKENFILE = '${
|
_SASJS_TOKENFILE = '${
|
||||||
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
|
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
|
||||||
}';
|
}';
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export const processProgram = async (
|
|||||||
vars: ExecutionVars,
|
vars: ExecutionVars,
|
||||||
session: Session,
|
session: Session,
|
||||||
weboutPath: string,
|
weboutPath: string,
|
||||||
|
headersPath: string,
|
||||||
tokenFile: string,
|
tokenFile: string,
|
||||||
runTime: RunTimeType,
|
runTime: RunTimeType,
|
||||||
logPath: string,
|
logPath: string,
|
||||||
@@ -30,6 +31,7 @@ export const processProgram = async (
|
|||||||
vars,
|
vars,
|
||||||
session,
|
session,
|
||||||
weboutPath,
|
weboutPath,
|
||||||
|
headersPath,
|
||||||
tokenFile,
|
tokenFile,
|
||||||
otherArgs
|
otherArgs
|
||||||
)
|
)
|
||||||
@@ -66,6 +68,7 @@ export const processProgram = async (
|
|||||||
vars,
|
vars,
|
||||||
session,
|
session,
|
||||||
weboutPath,
|
weboutPath,
|
||||||
|
headersPath,
|
||||||
tokenFile,
|
tokenFile,
|
||||||
otherArgs
|
otherArgs
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ const makeRequestAndAssert = async (
|
|||||||
expect.anything(),
|
expect.anything(),
|
||||||
expect.anything(),
|
expect.anything(),
|
||||||
expect.anything(),
|
expect.anything(),
|
||||||
|
expect.anything(),
|
||||||
expectedRuntime,
|
expectedRuntime,
|
||||||
expect.anything(),
|
expect.anything(),
|
||||||
undefined
|
undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user