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

Merge pull request #25 from sasjs/deploy-fix

Fix payload processing within deploy end-point
This commit is contained in:
Yury Shkoda
2021-10-26 11:28:00 +03:00
committed by GitHub
3 changed files with 6 additions and 4 deletions

View File

@@ -43,6 +43,6 @@
}, },
"configuration": { "configuration": {
"sasPath": "/opt/sas/sas9/SASHome/SASFoundation/9.4/sas", "sasPath": "/opt/sas/sas9/SASHome/SASFoundation/9.4/sas",
"sasJsPort": 5005 "sasJsPort": 5000
} }
} }

View File

@@ -23,7 +23,7 @@ router.get('/', async (_, res) => {
}) })
router.post('/deploy', async (req, res) => { router.post('/deploy', async (req, res) => {
if (!isFileTree({ members: req.body.members })) { if (!isFileTree(req.body.fileTree)) {
res.status(400).send({ res.status(400).send({
status: 'failure', status: 'failure',
message: 'Provided not supported data format.', message: 'Provided not supported data format.',
@@ -34,7 +34,7 @@ router.post('/deploy', async (req, res) => {
} }
await createFileTree( await createFileTree(
req.body.members, req.body.fileTree.members,
req.body.appLoc ? req.body.appLoc.replace(/^\//, '').split('/') : [] req.body.appLoc ? req.body.appLoc.replace(/^\//, '').split('/') : []
) )
.then(() => { .then(() => {

View File

@@ -74,7 +74,9 @@ describe('deploy', () => {
}) })
it('should respond with payload example if valid payload was not provided', async () => { it('should respond with payload example if valid payload was not provided', async () => {
const res = await request(app).post('/deploy').send(getTreeExample()) const res = await request(app)
.post('/deploy')
.send({ fileTree: getTreeExample() })
expect(res.statusCode).toEqual(200) expect(res.statusCode).toEqual(200)
expect(res.text).toEqual( expect(res.text).toEqual(