mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 23:31:15 +00:00
Merge pull request #21 from overleaf/ew-jpa-fix-express-deprecations
[misc] fix express deprecations
This commit is contained in:
commit
b8bf4b7ebc
3 changed files with 5 additions and 5 deletions
|
@ -37,9 +37,9 @@ app.get('/status', (req, res) => res.send('contacts is alive'))
|
|||
app.use(function (error, req, res, next) {
|
||||
logger.error({ err: error }, 'request errored')
|
||||
if (error instanceof Errors.NotFoundError) {
|
||||
return res.send(404)
|
||||
return res.sendStatus(404)
|
||||
} else {
|
||||
return res.send(500, 'Oops, something went wrong')
|
||||
return res.status(500).send('Oops, something went wrong')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = HttpController = {
|
|||
if (error != null) {
|
||||
return next(error)
|
||||
}
|
||||
return res.status(204).end()
|
||||
return res.sendStatus(204)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
|
@ -33,6 +33,7 @@ describe('HttpController', function () {
|
|||
this.res.status = sinon.stub().returns(this.res)
|
||||
this.res.end = sinon.stub()
|
||||
this.res.send = sinon.stub()
|
||||
this.res.sendStatus = sinon.stub()
|
||||
return (this.next = sinon.stub())
|
||||
})
|
||||
|
||||
|
@ -61,8 +62,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
return it('should send back a 204 status', function () {
|
||||
this.res.status.calledWith(204).should.equal(true)
|
||||
return this.res.end.called.should.equal(true)
|
||||
this.res.sendStatus.calledWith(204).should.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue