|
|
@@ -57,7 +57,7 @@ module.exports = HttpController =
|
|
|
ProjectManager.getProjectDocsAndFlushIfOld project_id, projectStateHash, excludeVersions, (error, result) ->
|
|
|
timer.done()
|
|
|
if error instanceof Errors.ProjectStateChangedError
|
|
|
- res.send 409 # conflict
|
|
|
+ res.sendStatus 409 # conflict
|
|
|
else if error?
|
|
|
return next(error)
|
|
|
else
|
|
|
@@ -73,7 +73,7 @@ module.exports = HttpController =
|
|
|
if error?
|
|
|
return next(error)
|
|
|
else
|
|
|
- res.send 200
|
|
|
+ res.sendStatus 200
|
|
|
|
|
|
setDoc: (req, res, next = (error) ->) ->
|
|
|
doc_id = req.params.doc_id
|
|
|
@@ -82,14 +82,14 @@ module.exports = HttpController =
|
|
|
lineSize = HttpController._getTotalSizeOfLines(lines)
|
|
|
if lineSize > TWO_MEGABYTES
|
|
|
logger.log {project_id, doc_id, source, lineSize, user_id}, "document too large, returning 406 response"
|
|
|
- return res.send 406
|
|
|
+ return res.sendStatus 406
|
|
|
logger.log {project_id, doc_id, lines, source, user_id, undoing}, "setting doc via http"
|
|
|
timer = new Metrics.Timer("http.setDoc")
|
|
|
DocumentManager.setDocWithLock project_id, doc_id, lines, source, user_id, undoing, (error) ->
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, doc_id: doc_id, "set doc via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
|
|
|
flushDocIfLoaded: (req, res, next = (error) ->) ->
|
|
|
@@ -101,7 +101,7 @@ module.exports = HttpController =
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, doc_id: doc_id, "flushed doc via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
deleteDoc: (req, res, next = (error) ->) ->
|
|
|
doc_id = req.params.doc_id
|
|
|
@@ -117,7 +117,7 @@ module.exports = HttpController =
|
|
|
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, doc_id: doc_id, "deleted doc via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
flushProject: (req, res, next = (error) ->) ->
|
|
|
project_id = req.params.project_id
|
|
|
@@ -127,7 +127,7 @@ module.exports = HttpController =
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, "flushed project via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
deleteProject: (req, res, next = (error) ->) ->
|
|
|
project_id = req.params.project_id
|
|
|
@@ -139,14 +139,14 @@ module.exports = HttpController =
|
|
|
ProjectManager.queueFlushAndDeleteProject project_id, (error) ->
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, "queue delete of project via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
else
|
|
|
timer = new Metrics.Timer("http.deleteProject")
|
|
|
ProjectManager.flushAndDeleteProjectWithLocks project_id, options, (error) ->
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, "deleted project via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
deleteMultipleProjects: (req, res, next = (error) ->) ->
|
|
|
project_ids = req.body?.project_ids || []
|
|
|
@@ -156,7 +156,7 @@ module.exports = HttpController =
|
|
|
ProjectManager.queueFlushAndDeleteProject project_id, cb
|
|
|
, (error) ->
|
|
|
return next(error) if error?
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
acceptChanges: (req, res, next = (error) ->) ->
|
|
|
{project_id, doc_id} = req.params
|
|
|
@@ -169,7 +169,7 @@ module.exports = HttpController =
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log {project_id, doc_id}, "accepted #{ change_ids.length } changes via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
deleteComment: (req, res, next = (error) ->) ->
|
|
|
{project_id, doc_id, comment_id} = req.params
|
|
|
@@ -179,7 +179,7 @@ module.exports = HttpController =
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log {project_id, doc_id, comment_id}, "deleted comment via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
updateProject: (req, res, next = (error) ->) ->
|
|
|
timer = new Metrics.Timer("http.updateProject")
|
|
|
@@ -191,7 +191,7 @@ module.exports = HttpController =
|
|
|
timer.done()
|
|
|
return next(error) if error?
|
|
|
logger.log project_id: project_id, "updated project via http"
|
|
|
- res.send 204 # No Content
|
|
|
+ res.sendStatus 204 # No Content
|
|
|
|
|
|
resyncProjectHistory: (req, res, next = (error) ->) ->
|
|
|
project_id = req.params.project_id
|
|
|
@@ -201,7 +201,7 @@ module.exports = HttpController =
|
|
|
HistoryManager.resyncProjectHistory project_id, projectHistoryId, docs, files, (error) ->
|
|
|
return next(error) if error?
|
|
|
logger.log {project_id}, "queued project history resync via http"
|
|
|
- res.send 204
|
|
|
+ res.sendStatus 204
|
|
|
|
|
|
flushAllProjects: (req, res, next = (error)-> )->
|
|
|
res.setTimeout(5 * 60 * 1000)
|
|
|
@@ -212,7 +212,7 @@ module.exports = HttpController =
|
|
|
ProjectFlusher.flushAllProjects options, (err, project_ids)->
|
|
|
if err?
|
|
|
logger.err err:err, "error bulk flushing projects"
|
|
|
- res.send 500
|
|
|
+ res.sendStatus 500
|
|
|
else
|
|
|
res.send project_ids
|
|
|
|
|
|
@@ -225,7 +225,7 @@ module.exports = HttpController =
|
|
|
DeleteQueueManager.flushAndDeleteOldProjects options, (err, flushed)->
|
|
|
if err?
|
|
|
logger.err err:err, "error flushing old projects"
|
|
|
- res.send 500
|
|
|
+ res.sendStatus 500
|
|
|
else
|
|
|
logger.log {flushed: flushed}, "flush of queued projects completed"
|
|
|
res.send {flushed: flushed}
|