mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-10-24 17:04:12 +00:00
fix: ignore messaging_hook in application create/update (#567)
messaging_hook was removed along with smpp (#559), but POST and PUT /Applications still pass the request body straight into the INSERT/UPDATE. Clients that still send messaging_hook (even as null) get a 500: "Unknown column 'messaging_hook' in 'field list'". Drop the field from the request body so older clients keep working. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df686e42b2
commit
d657a0cb2d
2 files changed
+47
-1
No files matched your search
+43
-1
@@ -52,7 +52,34 @@ test('application tests', async(t) => {
|
||||
}
|
||||
});
|
||||
t.ok(result.statusCode === 400, 'Cant create application with invalid app_json');
|
||||
|
||||
|
||||
/* messaging_hook was removed with smpp; older clients that still send it must not fail */
|
||||
result = await request.post('/Applications', {
|
||||
resolveWithFullResponse: true,
|
||||
simple: false,
|
||||
auth: authAdmin,
|
||||
json: true,
|
||||
body: {
|
||||
name: 'legacy-client',
|
||||
account_sid,
|
||||
call_hook: {
|
||||
url: 'http://example.com'
|
||||
},
|
||||
call_status_hook: {
|
||||
url: 'http://example.com/status'
|
||||
},
|
||||
messaging_hook: {
|
||||
url: 'http://example.com/sms'
|
||||
}
|
||||
}
|
||||
});
|
||||
t.ok(result.statusCode === 201, 'messaging_hook is ignored when creating an application');
|
||||
result = await request.delete(`/Applications/${result.body.sid}`, {
|
||||
auth: authAdmin,
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
t.ok(result.statusCode === 204, 'deleted application created with messaging_hook');
|
||||
|
||||
/* add an application */
|
||||
result = await request.post('/Applications', {
|
||||
resolveWithFullResponse: true,
|
||||
@@ -196,6 +223,21 @@ test('application tests', async(t) => {
|
||||
});
|
||||
t.ok(result.statusCode === 204, 'successfully updated application');
|
||||
|
||||
/* messaging_hook is ignored on update too */
|
||||
result = await request.put(`/Applications/${sid}`, {
|
||||
auth: authAdmin,
|
||||
json: true,
|
||||
resolveWithFullResponse: true,
|
||||
simple: false,
|
||||
body: {
|
||||
name: 'daveh',
|
||||
messaging_hook: {
|
||||
url: 'http://example.com/sms'
|
||||
}
|
||||
}
|
||||
});
|
||||
t.ok(result.statusCode === 204, 'messaging_hook is ignored when updating an application');
|
||||
|
||||
/* validate app_json was removed */
|
||||
result = await request.get(`/Applications/${sid}`, {
|
||||
auth: authAdmin,
|
||||
|
||||
Reference in new issue
Block a user