diff --git a/lib/routes/api/applications.js b/lib/routes/api/applications.js index 056c3b2..6203fd1 100644 --- a/lib/routes/api/applications.js +++ b/lib/routes/api/applications.js @@ -104,7 +104,7 @@ router.get('/:sid', async(req, res) => { const account_sid = req.user.hasAccountAuth ? req.user.account_sid : null; const results = await Application.retrieve(req.params.sid, service_provider_sid, account_sid); if (results.length === 0) return res.status(404).end(); - return res.status(200).json(results[0]); + return res.status(200).json(results); } catch (err) { sysError(logger, res, err); diff --git a/test/applications.js b/test/applications.js index 4728cab..5ede901 100644 --- a/test/applications.js +++ b/test/applications.js @@ -60,8 +60,8 @@ test('application tests', async(t) => { auth: authAdmin, json: true, }); - t.ok(result.name === 'daveh' , 'successfully retrieved application by sid'); - t.ok(result.messaging_hook.url === 'http://example.com/sms' , 'successfully retrieved messaging_hook from application'); + t.ok(result[0].name === 'daveh' , 'successfully retrieved application by sid'); + t.ok(result[0].messaging_hook.url === 'http://example.com/sms' , 'successfully retrieved messaging_hook from application'); /* update applications */ result = await request.put(`/Applications/${sid}`, { @@ -84,7 +84,7 @@ test('application tests', async(t) => { auth: authAdmin, json: true, }); - t.ok(result.messaging_hook.url === 'http://example2.com/mms' , 'successfully updated messaging_hook'); + t.ok(result[0].messaging_hook.url === 'http://example2.com/mms' , 'successfully updated messaging_hook'); /* assign phone number to application */ result = await request.put(`/PhoneNumbers/${phone_number_sid}`, { diff --git a/test/auth.js b/test/auth.js index 41e8397..756cee8 100644 --- a/test/auth.js +++ b/test/auth.js @@ -318,7 +318,7 @@ test('authentication tests', async(t) => { json: true }); //console.log(`result: ${JSON.stringify(result)}`); - t.ok(result.name === "A1-app", 'using account token A1 we are able to retrieve application A1'); + t.ok(result.length === 1, 'using account token A1 we are able to retrieve application A1'); /* cannot see app under another account using account token */ result = await request.get(`/Applications/${appA2}`, {