updated mock methods to express v4 signatures

This commit is contained in:
mserranom 2020-03-23 11:17:32 +01:00
parent 79f6b9a877
commit dd3673d5c0
3 changed files with 10 additions and 10 deletions

View file

@ -28,10 +28,10 @@ module.exports = MockDocUpdaterApi = {
app.get('/project/:project_id/doc', (req, res, next) => {
return this.getAllDoc(req.params.project_id, (error, docs) => {
if (error != null) {
res.send(500)
res.sendStatus(500)
}
if (docs == null) {
return res.send(404)
return res.sendStatus(404)
} else {
return res.send(JSON.stringify(docs))
}

View file

@ -45,10 +45,10 @@ module.exports = MockDocUpdaterApi = {
req.params.doc_id,
(error, doc) => {
if (error != null) {
res.send(500)
res.sendStatus(500)
}
if (doc == null) {
return res.send(404)
return res.sendStatus(404)
} else {
return res.send(JSON.stringify(doc))
}
@ -67,9 +67,9 @@ module.exports = MockDocUpdaterApi = {
req.body.undoing,
(errr, doc) => {
if (typeof error !== 'undefined' && error !== null) {
return res.send(500)
return res.sendStatus(500)
} else {
return res.send(204)
return res.sendStatus(204)
}
}
)

View file

@ -37,10 +37,10 @@ module.exports = MockWebApi = {
app.get('/user/:user_id/personal_info', (req, res, next) => {
return this.getUserInfo(req.params.user_id, (error, user) => {
if (error != null) {
res.send(500)
res.sendStatus(500)
}
if (user == null) {
return res.send(404)
return res.sendStatus(404)
} else {
return res.send(JSON.stringify(user))
}
@ -50,10 +50,10 @@ module.exports = MockWebApi = {
app.get('/project/:project_id/details', (req, res, next) => {
return this.getProjectDetails(req.params.project_id, (error, project) => {
if (error != null) {
res.send(500)
res.sendStatus(500)
}
if (project == null) {
return res.send(404)
return res.sendStatus(404)
} else {
return res.send(JSON.stringify(project))
}