mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #125 from overleaf/sk-upgrade-dependencies
Upgrade dependencies
This commit is contained in:
commit
853dbd8880
13 changed files with 1445 additions and 689 deletions
|
@ -1,7 +1,6 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
FROM node:10.19.0 as base
|
FROM node:10.19.0 as base
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
BUILD_NUMBER ?= local
|
BUILD_NUMBER ?= local
|
||||||
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
|
@ -21,15 +21,14 @@ mongojs = require "./app/js/mongojs"
|
||||||
async = require "async"
|
async = require "async"
|
||||||
|
|
||||||
Path = require "path"
|
Path = require "path"
|
||||||
|
bodyParser = require "body-parser"
|
||||||
|
|
||||||
Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
|
Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
|
||||||
Metrics.event_loop.monitor(logger, 100)
|
Metrics.event_loop.monitor(logger, 100)
|
||||||
|
|
||||||
app = express()
|
app = express()
|
||||||
app.configure ->
|
app.use(Metrics.http.monitor(logger));
|
||||||
app.use(Metrics.http.monitor(logger));
|
app.use bodyParser.json({limit: (Settings.max_doc_length + 64 * 1024)})
|
||||||
app.use express.bodyParser({limit: (Settings.max_doc_length + 64 * 1024)})
|
|
||||||
app.use app.router
|
|
||||||
Metrics.injectMetricsRoute(app)
|
Metrics.injectMetricsRoute(app)
|
||||||
|
|
||||||
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)
|
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)
|
||||||
|
@ -62,7 +61,7 @@ app.post '/project/:project_id/history/resync', HttpCont
|
||||||
app.post '/project/:project_id/flush', HttpController.flushProject
|
app.post '/project/:project_id/flush', HttpController.flushProject
|
||||||
app.post '/project/:project_id/doc/:doc_id/change/:change_id/accept', HttpController.acceptChanges
|
app.post '/project/:project_id/doc/:doc_id/change/:change_id/accept', HttpController.acceptChanges
|
||||||
app.post '/project/:project_id/doc/:doc_id/change/accept', HttpController.acceptChanges
|
app.post '/project/:project_id/doc/:doc_id/change/accept', HttpController.acceptChanges
|
||||||
app.del '/project/:project_id/doc/:doc_id/comment/:comment_id', HttpController.deleteComment
|
app.delete '/project/:project_id/doc/:doc_id/comment/:comment_id', HttpController.deleteComment
|
||||||
|
|
||||||
app.get '/flush_all_projects', HttpController.flushAllProjects
|
app.get '/flush_all_projects', HttpController.flushAllProjects
|
||||||
app.get '/flush_queued_projects', HttpController.flushQueuedProjects
|
app.get '/flush_queued_projects', HttpController.flushQueuedProjects
|
||||||
|
@ -75,7 +74,7 @@ app.get '/total', (req, res)->
|
||||||
|
|
||||||
app.get '/status', (req, res)->
|
app.get '/status', (req, res)->
|
||||||
if Settings.shuttingDown
|
if Settings.shuttingDown
|
||||||
res.send 503 # Service unavailable
|
res.sendStatus 503 # Service unavailable
|
||||||
else
|
else
|
||||||
res.send('document updater is alive')
|
res.send('document updater is alive')
|
||||||
|
|
||||||
|
@ -84,18 +83,18 @@ app.get "/health_check/redis", (req, res, next) ->
|
||||||
pubsubClient.healthCheck (error) ->
|
pubsubClient.healthCheck (error) ->
|
||||||
if error?
|
if error?
|
||||||
logger.err {err: error}, "failed redis health check"
|
logger.err {err: error}, "failed redis health check"
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send 200
|
res.sendStatus 200
|
||||||
|
|
||||||
docUpdaterRedisClient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
|
docUpdaterRedisClient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
|
||||||
app.get "/health_check/redis_cluster", (req, res, next) ->
|
app.get "/health_check/redis_cluster", (req, res, next) ->
|
||||||
docUpdaterRedisClient.healthCheck (error) ->
|
docUpdaterRedisClient.healthCheck (error) ->
|
||||||
if error?
|
if error?
|
||||||
logger.err {err: error}, "failed redis cluster health check"
|
logger.err {err: error}, "failed redis cluster health check"
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send 200
|
res.sendStatus 200
|
||||||
|
|
||||||
app.get "/health_check", (req, res, next) ->
|
app.get "/health_check", (req, res, next) ->
|
||||||
async.series [
|
async.series [
|
||||||
|
@ -116,20 +115,20 @@ app.get "/health_check", (req, res, next) ->
|
||||||
cb(error)
|
cb(error)
|
||||||
] , (error) ->
|
] , (error) ->
|
||||||
if error?
|
if error?
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send 200
|
res.sendStatus 200
|
||||||
|
|
||||||
app.use (error, req, res, next) ->
|
app.use (error, req, res, next) ->
|
||||||
if error instanceof Errors.NotFoundError
|
if error instanceof Errors.NotFoundError
|
||||||
res.send 404
|
res.sendStatus 404
|
||||||
else if error instanceof Errors.OpRangeNotAvailableError
|
else if error instanceof Errors.OpRangeNotAvailableError
|
||||||
res.send 422 # Unprocessable Entity
|
res.sendStatus 422 # Unprocessable Entity
|
||||||
else if error.statusCode is 413
|
else if error.statusCode is 413
|
||||||
res.send(413, "request entity too large")
|
res.status(413).send("request entity too large")
|
||||||
else
|
else
|
||||||
logger.error err: error, req: req, "request errored"
|
logger.error err: error, req: req, "request errored"
|
||||||
res.send(500, "Oops, something went wrong")
|
res.status(500).send("Oops, something went wrong")
|
||||||
|
|
||||||
shutdownCleanly = (signal) ->
|
shutdownCleanly = (signal) ->
|
||||||
return () ->
|
return () ->
|
||||||
|
|
|
@ -57,7 +57,7 @@ module.exports = HttpController =
|
||||||
ProjectManager.getProjectDocsAndFlushIfOld project_id, projectStateHash, excludeVersions, (error, result) ->
|
ProjectManager.getProjectDocsAndFlushIfOld project_id, projectStateHash, excludeVersions, (error, result) ->
|
||||||
timer.done()
|
timer.done()
|
||||||
if error instanceof Errors.ProjectStateChangedError
|
if error instanceof Errors.ProjectStateChangedError
|
||||||
res.send 409 # conflict
|
res.sendStatus 409 # conflict
|
||||||
else if error?
|
else if error?
|
||||||
return next(error)
|
return next(error)
|
||||||
else
|
else
|
||||||
|
@ -73,7 +73,7 @@ module.exports = HttpController =
|
||||||
if error?
|
if error?
|
||||||
return next(error)
|
return next(error)
|
||||||
else
|
else
|
||||||
res.send 200
|
res.sendStatus 200
|
||||||
|
|
||||||
setDoc: (req, res, next = (error) ->) ->
|
setDoc: (req, res, next = (error) ->) ->
|
||||||
doc_id = req.params.doc_id
|
doc_id = req.params.doc_id
|
||||||
|
@ -82,14 +82,14 @@ module.exports = HttpController =
|
||||||
lineSize = HttpController._getTotalSizeOfLines(lines)
|
lineSize = HttpController._getTotalSizeOfLines(lines)
|
||||||
if lineSize > TWO_MEGABYTES
|
if lineSize > TWO_MEGABYTES
|
||||||
logger.log {project_id, doc_id, source, lineSize, user_id}, "document too large, returning 406 response"
|
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"
|
logger.log {project_id, doc_id, lines, source, user_id, undoing}, "setting doc via http"
|
||||||
timer = new Metrics.Timer("http.setDoc")
|
timer = new Metrics.Timer("http.setDoc")
|
||||||
DocumentManager.setDocWithLock project_id, doc_id, lines, source, user_id, undoing, (error) ->
|
DocumentManager.setDocWithLock project_id, doc_id, lines, source, user_id, undoing, (error) ->
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, doc_id: doc_id, "set doc via http"
|
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) ->) ->
|
flushDocIfLoaded: (req, res, next = (error) ->) ->
|
||||||
|
@ -101,7 +101,7 @@ module.exports = HttpController =
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, doc_id: doc_id, "flushed doc via http"
|
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) ->) ->
|
deleteDoc: (req, res, next = (error) ->) ->
|
||||||
doc_id = req.params.doc_id
|
doc_id = req.params.doc_id
|
||||||
|
@ -117,7 +117,7 @@ module.exports = HttpController =
|
||||||
|
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, doc_id: doc_id, "deleted doc via http"
|
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) ->) ->
|
flushProject: (req, res, next = (error) ->) ->
|
||||||
project_id = req.params.project_id
|
project_id = req.params.project_id
|
||||||
|
@ -127,7 +127,7 @@ module.exports = HttpController =
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, "flushed project via http"
|
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) ->) ->
|
deleteProject: (req, res, next = (error) ->) ->
|
||||||
project_id = req.params.project_id
|
project_id = req.params.project_id
|
||||||
|
@ -139,14 +139,14 @@ module.exports = HttpController =
|
||||||
ProjectManager.queueFlushAndDeleteProject project_id, (error) ->
|
ProjectManager.queueFlushAndDeleteProject project_id, (error) ->
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, "queue delete of project via http"
|
logger.log project_id: project_id, "queue delete of project via http"
|
||||||
res.send 204 # No Content
|
res.sendStatus 204 # No Content
|
||||||
else
|
else
|
||||||
timer = new Metrics.Timer("http.deleteProject")
|
timer = new Metrics.Timer("http.deleteProject")
|
||||||
ProjectManager.flushAndDeleteProjectWithLocks project_id, options, (error) ->
|
ProjectManager.flushAndDeleteProjectWithLocks project_id, options, (error) ->
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, "deleted project via http"
|
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) ->) ->
|
deleteMultipleProjects: (req, res, next = (error) ->) ->
|
||||||
project_ids = req.body?.project_ids || []
|
project_ids = req.body?.project_ids || []
|
||||||
|
@ -156,7 +156,7 @@ module.exports = HttpController =
|
||||||
ProjectManager.queueFlushAndDeleteProject project_id, cb
|
ProjectManager.queueFlushAndDeleteProject project_id, cb
|
||||||
, (error) ->
|
, (error) ->
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
res.send 204 # No Content
|
res.sendStatus 204 # No Content
|
||||||
|
|
||||||
acceptChanges: (req, res, next = (error) ->) ->
|
acceptChanges: (req, res, next = (error) ->) ->
|
||||||
{project_id, doc_id} = req.params
|
{project_id, doc_id} = req.params
|
||||||
|
@ -169,7 +169,7 @@ module.exports = HttpController =
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log {project_id, doc_id}, "accepted #{ change_ids.length } changes via http"
|
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) ->) ->
|
deleteComment: (req, res, next = (error) ->) ->
|
||||||
{project_id, doc_id, comment_id} = req.params
|
{project_id, doc_id, comment_id} = req.params
|
||||||
|
@ -179,7 +179,7 @@ module.exports = HttpController =
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log {project_id, doc_id, comment_id}, "deleted comment via http"
|
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) ->) ->
|
updateProject: (req, res, next = (error) ->) ->
|
||||||
timer = new Metrics.Timer("http.updateProject")
|
timer = new Metrics.Timer("http.updateProject")
|
||||||
|
@ -191,7 +191,7 @@ module.exports = HttpController =
|
||||||
timer.done()
|
timer.done()
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log project_id: project_id, "updated project via http"
|
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) ->) ->
|
resyncProjectHistory: (req, res, next = (error) ->) ->
|
||||||
project_id = req.params.project_id
|
project_id = req.params.project_id
|
||||||
|
@ -201,7 +201,7 @@ module.exports = HttpController =
|
||||||
HistoryManager.resyncProjectHistory project_id, projectHistoryId, docs, files, (error) ->
|
HistoryManager.resyncProjectHistory project_id, projectHistoryId, docs, files, (error) ->
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
logger.log {project_id}, "queued project history resync via http"
|
logger.log {project_id}, "queued project history resync via http"
|
||||||
res.send 204
|
res.sendStatus 204
|
||||||
|
|
||||||
flushAllProjects: (req, res, next = (error)-> )->
|
flushAllProjects: (req, res, next = (error)-> )->
|
||||||
res.setTimeout(5 * 60 * 1000)
|
res.setTimeout(5 * 60 * 1000)
|
||||||
|
@ -212,7 +212,7 @@ module.exports = HttpController =
|
||||||
ProjectFlusher.flushAllProjects options, (err, project_ids)->
|
ProjectFlusher.flushAllProjects options, (err, project_ids)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, "error bulk flushing projects"
|
logger.err err:err, "error bulk flushing projects"
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send project_ids
|
res.send project_ids
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ module.exports = HttpController =
|
||||||
DeleteQueueManager.flushAndDeleteOldProjects options, (err, flushed)->
|
DeleteQueueManager.flushAndDeleteOldProjects options, (err, flushed)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, "error flushing old projects"
|
logger.err err:err, "error flushing old projects"
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
logger.log {flushed: flushed}, "flush of queued projects completed"
|
logger.log {flushed: flushed}, "flush of queued projects completed"
|
||||||
res.send {flushed: flushed}
|
res.send {flushed: flushed}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
document-updater
|
document-updater
|
||||||
--public-repo=True
|
|
||||||
--language=coffeescript
|
|
||||||
--env-add=
|
|
||||||
--node-version=10.19.0
|
|
||||||
--acceptance-creds=None
|
--acceptance-creds=None
|
||||||
--dependencies=mongo,redis
|
--dependencies=mongo,redis
|
||||||
--docker-repos=gcr.io/overleaf-ops
|
--docker-repos=gcr.io/overleaf-ops
|
||||||
|
--env-add=
|
||||||
--env-pass-through=
|
--env-pass-through=
|
||||||
--script-version=1.3.5
|
--language=coffeescript
|
||||||
|
--node-version=10.19.0
|
||||||
|
--public-repo=True
|
||||||
|
--script-version=2.0.0
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
version: "2.3"
|
version: "2.3"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# This file was auto-generated, do not edit it directly.
|
# This file was auto-generated, do not edit it directly.
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
# Version: 1.3.5
|
|
||||||
|
|
||||||
version: "2.3"
|
version: "2.3"
|
||||||
|
|
||||||
|
|
1986
services/document-updater/package-lock.json
generated
1986
services/document-updater/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -21,15 +21,16 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^2.5.0",
|
"async": "^2.5.0",
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
"bunyan": "~0.22.1",
|
"bunyan": "~0.22.1",
|
||||||
"coffee-script": "~1.7.0",
|
"coffee-script": "~1.7.0",
|
||||||
"express": "3.11.0",
|
"express": "4.17.1",
|
||||||
"lodash": "^4.17.13",
|
"lodash": "^4.17.13",
|
||||||
"logger-sharelatex": "^1.9.1",
|
"logger-sharelatex": "^1.9.1",
|
||||||
"metrics-sharelatex": "^2.6.2",
|
"metrics-sharelatex": "^2.6.2",
|
||||||
"mongojs": "^2.6.0",
|
"mongojs": "^3.1.0",
|
||||||
"redis-sharelatex": "^1.0.12",
|
"redis-sharelatex": "^1.0.12",
|
||||||
"request": "^2.47.0",
|
"request": "^2.88.2",
|
||||||
"requestretry": "^4.1.0",
|
"requestretry": "^4.1.0",
|
||||||
"settings-sharelatex": "^1.1.0"
|
"settings-sharelatex": "^1.1.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,9 +9,9 @@ module.exports = MockProjectHistoryApi =
|
||||||
app.post "/project/:project_id/flush", (req, res, next) =>
|
app.post "/project/:project_id/flush", (req, res, next) =>
|
||||||
@flushProject req.params.project_id, (error) ->
|
@flushProject req.params.project_id, (error) ->
|
||||||
if error?
|
if error?
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send 204
|
res.sendStatus 204
|
||||||
|
|
||||||
app.listen 3054, (error) ->
|
app.listen 3054, (error) ->
|
||||||
throw error if error?
|
throw error if error?
|
||||||
|
|
|
@ -9,9 +9,9 @@ module.exports = MockTrackChangesApi =
|
||||||
app.post "/project/:project_id/doc/:doc_id/flush", (req, res, next) =>
|
app.post "/project/:project_id/doc/:doc_id/flush", (req, res, next) =>
|
||||||
@flushDoc req.params.doc_id, (error) ->
|
@flushDoc req.params.doc_id, (error) ->
|
||||||
if error?
|
if error?
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send 204
|
res.sendStatus 204
|
||||||
|
|
||||||
app.listen 3015, (error) ->
|
app.listen 3015, (error) ->
|
||||||
throw error if error?
|
throw error if error?
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
express = require("express")
|
express = require("express")
|
||||||
|
bodyParser = require("body-parser")
|
||||||
app = express()
|
app = express()
|
||||||
MAX_REQUEST_SIZE = 2*(2*1024*1024 + 64*1024)
|
MAX_REQUEST_SIZE = 2*(2*1024*1024 + 64*1024)
|
||||||
|
|
||||||
|
@ -30,18 +31,18 @@ module.exports = MockWebApi =
|
||||||
app.get "/project/:project_id/doc/:doc_id", (req, res, next) =>
|
app.get "/project/:project_id/doc/:doc_id", (req, res, next) =>
|
||||||
@getDocument req.params.project_id, req.params.doc_id, (error, doc) ->
|
@getDocument req.params.project_id, req.params.doc_id, (error, doc) ->
|
||||||
if error?
|
if error?
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else if doc?
|
else if doc?
|
||||||
res.send JSON.stringify doc
|
res.send JSON.stringify doc
|
||||||
else
|
else
|
||||||
res.send 404
|
res.sendStatus 404
|
||||||
|
|
||||||
app.post "/project/:project_id/doc/:doc_id", express.bodyParser({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
|
app.post "/project/:project_id/doc/:doc_id", bodyParser.json({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
|
||||||
MockWebApi.setDocument req.params.project_id, req.params.doc_id, req.body.lines, req.body.version, req.body.ranges, req.body.lastUpdatedAt, req.body.lastUpdatedBy, (error) ->
|
MockWebApi.setDocument req.params.project_id, req.params.doc_id, req.body.lines, req.body.version, req.body.ranges, req.body.lastUpdatedAt, req.body.lastUpdatedBy, (error) ->
|
||||||
if error?
|
if error?
|
||||||
res.send 500
|
res.sendStatus 500
|
||||||
else
|
else
|
||||||
res.send 204
|
res.sendStatus 204
|
||||||
|
|
||||||
app.listen 3000, (error) ->
|
app.listen 3000, (error) ->
|
||||||
throw error if error?
|
throw error if error?
|
||||||
|
|
|
@ -24,6 +24,7 @@ describe "HttpController", ->
|
||||||
@next = sinon.stub()
|
@next = sinon.stub()
|
||||||
@res =
|
@res =
|
||||||
send: sinon.stub()
|
send: sinon.stub()
|
||||||
|
sendStatus: sinon.stub()
|
||||||
json: sinon.stub()
|
json: sinon.stub()
|
||||||
|
|
||||||
describe "getDoc", ->
|
describe "getDoc", ->
|
||||||
|
@ -147,7 +148,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ describe "HttpController", ->
|
||||||
@HttpController.setDoc(@req, @res, @next)
|
@HttpController.setDoc(@req, @res, @next)
|
||||||
|
|
||||||
it 'should send back a 406 response', ->
|
it 'should send back a 406 response', ->
|
||||||
@res.send.calledWith(406).should.equal true
|
@res.sendStatus.calledWith(406).should.equal true
|
||||||
|
|
||||||
it 'should not call setDocWithLock', ->
|
it 'should not call setDocWithLock', ->
|
||||||
@DocumentManager.setDocWithLock.callCount.should.equal 0
|
@DocumentManager.setDocWithLock.callCount.should.equal 0
|
||||||
|
@ -201,7 +202,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -243,7 +244,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -289,7 +290,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -313,7 +314,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send.calledWith(204).should.equal true
|
@res.sendStatus.calledWith(204).should.equal true
|
||||||
|
|
||||||
describe "when an errors occurs", ->
|
describe "when an errors occurs", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -347,7 +348,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -399,7 +400,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -458,7 +459,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -524,7 +525,7 @@ describe "HttpController", ->
|
||||||
@HttpController.getProjectDocsAndFlushIfOld(@req, @res, @next)
|
@HttpController.getProjectDocsAndFlushIfOld(@req, @res, @next)
|
||||||
|
|
||||||
it "should return an HTTP 409 Conflict response", ->
|
it "should return an HTTP 409 Conflict response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(409)
|
.calledWith(409)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -561,7 +562,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
@ -601,7 +602,7 @@ describe "HttpController", ->
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return a successful No Content response", ->
|
it "should return a successful No Content response", ->
|
||||||
@res.send
|
@res.sendStatus
|
||||||
.calledWith(204)
|
.calledWith(204)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue