mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-24 13:02:16 +00:00
extend sid validation to all routes (#138)
Co-authored-by: Guilherme Rauen <g.rauen@cognigy.com>
This commit is contained in:
@@ -37,7 +37,7 @@ test('speech credentials tests', async(t) => {
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
t.ok(err.statusCode === 400, 'returns 400 bad request if sid param is not a valid uuid');
|
||||
t.ok(err.statusCode === 400, 'returns 400 bad request if service provider sid param is not a valid uuid');
|
||||
}
|
||||
|
||||
/* add a speech credential to a service provider */
|
||||
@@ -119,12 +119,20 @@ test('speech credentials tests', async(t) => {
|
||||
t.ok(result[0].vendor === 'google' && result.length === 1, 'successfully retrieved all speech credentials');
|
||||
|
||||
|
||||
/* return 404 when deleting unknown credentials */
|
||||
/* return 400 when deleting credentials with invalid uuid */
|
||||
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/foobarbaz`, {
|
||||
auth: authUser,
|
||||
resolveWithFullResponse: true,
|
||||
simple: false
|
||||
});
|
||||
t.ok(result.statusCode === 400, 'return 400 when attempting to delete credential with invalid uuid');
|
||||
|
||||
/* return 404 when deleting unknown credentials - randomSid: bed7ae17-f8b4-4b74-9e5b-4f6318aae9c9 */
|
||||
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/`, {
|
||||
auth: authUser,
|
||||
resolveWithFullResponse: true,
|
||||
simple: false
|
||||
});
|
||||
t.ok(result.statusCode === 404, 'return 404 when attempting to delete unknown credential');
|
||||
|
||||
/* delete the credential */
|
||||
|
||||
Reference in New Issue
Block a user