Преглед изворни кода

Merge pull request #2194 from overleaf/ho-res-send-status

use sendStatus for status codes, prevents errors in logs

GitOrigin-RevId: 98613a3c894a01eb9112fa9472403caeeae45bc2
Eric Mc Sween пре 7 година
родитељ
комит
0e6b455ab0

+ 2 - 2
services/web/app/src/Features/Analytics/AnalyticsController.js

@@ -69,10 +69,10 @@ module.exports = {
 var respondWith = function(error, res, next) {
   if (error instanceof Errors.ServiceNotConfiguredError) {
     // ignore, no-op
-    res.send(204)
+    res.sendStatus(204)
   } else if (error) {
     next(error)
   } else {
-    res.send(204)
+    res.sendStatus(204)
   }
 }

+ 4 - 1
services/web/test/unit/src/Analytics/AnalyticsControllerTests.js

@@ -37,7 +37,10 @@ describe('AnalyticsController', function() {
       }
     })
 
-    this.res = { send() {} }
+    this.res = {
+      send() {},
+      sendStatus() {}
+    }
   })
 
   describe('updateEditingSession', function() {