diff --git a/services/notifications/app.js b/services/notifications/app.js index 765db2edd7..552b82250a 100644 --- a/services/notifications/app.js +++ b/services/notifications/app.js @@ -33,12 +33,12 @@ metrics.injectMetricsRoute(app) app.post('/user/:user_id', controller.addNotification) app.get('/user/:user_id', controller.getUserNotifications) -app.del( +app.delete( '/user/:user_id/notification/:notification_id', controller.removeNotificationId ) -app.del('/user/:user_id', controller.removeNotificationKey) -app.del('/key/:key', controller.removeNotificationByKeyOnly) +app.delete('/user/:user_id', controller.removeNotificationKey) +app.delete('/key/:key', controller.removeNotificationByKeyOnly) app.get('/status', (req, res) => res.send('notifications sharelatex up')) @@ -46,14 +46,14 @@ app.get('/health_check', (req, res) => HealthCheckController.check(function(err) { if (err != null) { logger.err({ err }, 'error performing health check') - return res.send(500) + return res.sendStatus(500) } else { - return res.send(200) + return res.sendStatus(200) } }) ) -app.get('*', (req, res) => res.send(404)) +app.get('*', (req, res) => res.sendStatus(404)) const host = __guard__( diff --git a/services/notifications/app/js/NotificationsController.js b/services/notifications/app/js/NotificationsController.js index f6c60381d6..56aae026f9 100644 --- a/services/notifications/app/js/NotificationsController.js +++ b/services/notifications/app/js/NotificationsController.js @@ -40,7 +40,7 @@ module.exports = { if (err != null) { return res.sendStatus(500) } else { - return res.send() + return res.sendStatus(200) } }) }, @@ -57,7 +57,7 @@ module.exports = { return Notifications.removeNotificationId( req.params.user_id, req.params.notification_id, - (err, notifications) => res.send() + (err, notifications) => res.sendStatus(200) ) }, @@ -70,7 +70,7 @@ module.exports = { return Notifications.removeNotificationKey( req.params.user_id, req.body.key, - (err, notifications) => res.send() + (err, notifications) => res.sendStatus(200) ) }, @@ -80,7 +80,7 @@ module.exports = { metrics.inc('removeNotificationKey') return Notifications.removeNotificationByKeyOnly( notification_key, - (err, notifications) => res.send() + (err, notifications) => res.sendStatus(200) ) } } diff --git a/services/notifications/test/unit/js/NotificationsControllerTest.js b/services/notifications/test/unit/js/NotificationsControllerTest.js index f62b2c3c01..b38e5176e5 100644 --- a/services/notifications/test/unit/js/NotificationsControllerTest.js +++ b/services/notifications/test/unit/js/NotificationsControllerTest.js @@ -76,10 +76,11 @@ describe('Notifications Controller', function() { body: this.stubbedNotification } return this.controller.addNotification(req, { - send: result => { + sendStatus: code => { this.notifications.addNotification .calledWith(user_id, this.stubbedNotification) .should.equal(true) + code.should.equal(200) return done() } }) @@ -96,10 +97,11 @@ describe('Notifications Controller', function() { } } return this.controller.removeNotificationId(req, { - send: result => { + sendStatus: code => { this.notifications.removeNotificationId .calledWith(user_id, notification_id) .should.equal(true) + code.should.equal(200) return done() } }) @@ -116,10 +118,11 @@ describe('Notifications Controller', function() { body: { key: notification_key } } return this.controller.removeNotificationKey(req, { - send: result => { + sendStatus: code => { this.notifications.removeNotificationKey .calledWith(user_id, notification_key) .should.equal(true) + code.should.equal(200) return done() } }) @@ -137,10 +140,11 @@ describe('Notifications Controller', function() { } } return this.controller.removeNotificationByKeyOnly(req, { - send: result => { + sendStatus: code => { this.notifications.removeNotificationByKeyOnly .calledWith(notification_key) .should.equal(true) + code.should.equal(200) return done() } })