Compare commits

...

1 Commits

Author SHA1 Message Date
Lê Hàn Minh Khang
a9bc306d12 Revert "Fix application /:sid return (#54)"
This reverts commit c5b1b36f28.
2022-08-17 18:56:33 -04:00
3 changed files with 5 additions and 5 deletions

View File

@@ -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);

View File

@@ -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}`, {

View File

@@ -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}`, {