mirror of
https://github.com/sasjs/server.git
synced 2026-01-06 22:20:06 +00:00
fix(file): fixes response headers
This commit is contained in:
@@ -41,7 +41,10 @@ const executeSASCode = async (req: any, { code }: ExecuteSASCodePayload) => {
|
||||
true
|
||||
)) as ExecuteReturnJson
|
||||
|
||||
if (webout instanceof Buffer) return webout
|
||||
if (webout instanceof Buffer) {
|
||||
;(req as any).sasHeaders = httpHeaders
|
||||
return webout
|
||||
}
|
||||
|
||||
return {
|
||||
status: 'success',
|
||||
|
||||
@@ -148,7 +148,7 @@ ${program}`
|
||||
? await readFile(headersPath)
|
||||
: ''
|
||||
const httpHeaders: HTTPHeaders = extractHeaders(headersContent)
|
||||
const fileResponse: boolean = httpHeaders.hasOwnProperty('Content-Type')
|
||||
const fileResponse: boolean = httpHeaders.hasOwnProperty('content-type')
|
||||
|
||||
const webout = (await fileExists(weboutPath))
|
||||
? fileResponse
|
||||
|
||||
@@ -113,8 +113,9 @@ const executeReturnRaw = async (
|
||||
|
||||
req.res?.set(httpHeaders)
|
||||
|
||||
// if (result instanceof Buffer)
|
||||
// req.res?.writeHead(200, httpHeaders)
|
||||
if (result instanceof Buffer) {
|
||||
;(req as any).sasHeaders = httpHeaders
|
||||
}
|
||||
|
||||
return result
|
||||
} catch (err: any) {
|
||||
@@ -148,7 +149,10 @@ const executeReturnJson = async (
|
||||
true
|
||||
)) as ExecuteReturnJson
|
||||
|
||||
if (webout instanceof Buffer) return webout
|
||||
if (webout instanceof Buffer) {
|
||||
;(req as any).sasHeaders = httpHeaders
|
||||
return webout
|
||||
}
|
||||
|
||||
return {
|
||||
status: 'success',
|
||||
|
||||
Reference in New Issue
Block a user