mirror of
https://github.com/sasjs/server.git
synced 2026-01-02 12:50:05 +00:00
fix: added http headers to /code api as well
This commit is contained in:
@@ -30,15 +30,20 @@ export class CodeController {
|
|||||||
|
|
||||||
const executeSASCode = async (req: any, { code }: ExecuteSASCodePayload) => {
|
const executeSASCode = async (req: any, { code }: ExecuteSASCodePayload) => {
|
||||||
try {
|
try {
|
||||||
const { result } = (await new ExecutionController().executeProgram(
|
const { result, httpHeaders } =
|
||||||
code,
|
(await new ExecutionController().executeProgram(
|
||||||
getPreProgramVariables(req),
|
code,
|
||||||
{ ...req.query, _debug: 131 },
|
getPreProgramVariables(req),
|
||||||
undefined,
|
{ ...req.query, _debug: 131 },
|
||||||
true
|
undefined,
|
||||||
)) as ExecuteReturnRaw
|
true
|
||||||
|
)) as ExecuteReturnRaw
|
||||||
|
|
||||||
return result as string
|
Object.entries(httpHeaders).forEach(([key, value]) => {
|
||||||
|
req.res?.set(key, value)
|
||||||
|
})
|
||||||
|
|
||||||
|
return result
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
throw {
|
throw {
|
||||||
code: 400,
|
code: 400,
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const executeReturnRaw = async (
|
|||||||
query
|
query
|
||||||
)) as ExecuteReturnRaw
|
)) as ExecuteReturnRaw
|
||||||
|
|
||||||
Object.entries(httpHeaders ?? {}).forEach(([key, value]) => {
|
Object.entries(httpHeaders).forEach(([key, value]) => {
|
||||||
req.res?.set(key, value)
|
req.res?.set(key, value)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ const executeReturnJson = async (
|
|||||||
true
|
true
|
||||||
)) as ExecuteReturnJson
|
)) as ExecuteReturnJson
|
||||||
|
|
||||||
Object.entries(httpHeaders ?? {}).forEach(([key, value]) => {
|
Object.entries(httpHeaders).forEach(([key, value]) => {
|
||||||
req.res?.set(key, value)
|
req.res?.set(key, value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user