From 82768a0442e4810c14123ddaae145a1f8e313eeb Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 19 Feb 2021 08:48:50 -0500 Subject: [PATCH] update call uses a PUT now, not POST --- lib/http-routes/api/update-call.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/http-routes/api/update-call.js b/lib/http-routes/api/update-call.js index d4bfc2a7..56bd81a5 100644 --- a/lib/http-routes/api/update-call.js +++ b/lib/http-routes/api/update-call.js @@ -32,10 +32,7 @@ function retrieveCallSession(callSid, opts) { return cs; } -/** - * update a call - */ -router.post('/:callSid', async(req, res) => { +const updateCall = async(req, res) => { const logger = req.app.locals.logger; const callSid = req.params.callSid; logger.debug({body: req.body}, 'got upateCall request'); @@ -45,11 +42,23 @@ router.post('/:callSid', async(req, res) => { logger.info(`updateCall: callSid not found ${callSid}`); return res.sendStatus(404); } - res.sendStatus(202); + res.sendStatus(204); cs.updateCall(req.body, callSid); } catch (err) { sysError(logger, res, err); } +}; + +/** + * update a call + */ + +/* leaving in for legacy; should have been (and now is) a PUT */ +router.post('/:callSid', async(req, res) => { + await updateCall(req, res); +}); +router.put('/:callSid', async(req, res) => { + await updateCall(req, res); }); module.exports = router;