1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-03 21:10:05 +00:00

test: fixed unhandled timeout

This commit is contained in:
Saad Jutt
2022-04-20 06:50:11 +05:00
parent d55a619d64
commit 7fe43ae0b7
9 changed files with 54 additions and 56 deletions

View File

@@ -22,11 +22,13 @@ const { MODE, CORS, WHITELIST } = process.env
if (MODE?.trim() !== 'server' || CORS?.trim() === 'enable') {
const whiteList: string[] = []
WHITELIST?.split(' ')?.forEach((url) => {
if (url.startsWith('http'))
// removing trailing slash of URLs listing for CORS
whiteList.push(url.replace(/\/$/, ''))
})
WHITELIST?.split(' ')
?.filter((url) => !!url)
.forEach((url) => {
if (url.startsWith('http'))
// removing trailing slash of URLs listing for CORS
whiteList.push(url.replace(/\/$/, ''))
})
console.log('All CORS Requests are enabled for:', whiteList)
app.use(cors({ credentials: true, origin: whiteList }))