mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:33:27 +00:00
replace deprecated send(code,body) calls
This commit is contained in:
parent
aa32cbc1ee
commit
608b1dd657
3 changed files with 13 additions and 8 deletions
|
@ -84,7 +84,7 @@ if Settings.smokeTest
|
|||
|
||||
app.get "/health_check", (req, res)->
|
||||
res.contentType(resCacher?.setContentType)
|
||||
res.send resCacher?.code, resCacher?.body
|
||||
res.status(resCacher?.code).send(resCacher?.body)
|
||||
|
||||
profiler = require "v8-profiler"
|
||||
app.get "/profile", (req, res) ->
|
||||
|
@ -101,7 +101,7 @@ app.get "/heapdump", (req, res)->
|
|||
|
||||
app.use (error, req, res, next) ->
|
||||
logger.error err: error, "server error"
|
||||
res.send error?.statusCode || 500
|
||||
res.sendStatus(error?.statusCode || 500)
|
||||
|
||||
app.listen port = (Settings.internal?.clsi?.port or 3013), host = (Settings.internal?.clsi?.host or "localhost"), (error) ->
|
||||
logger.info "CLSI starting up, listening on #{host}:#{port}"
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = CompileController =
|
|||
status = "success"
|
||||
|
||||
timer.done()
|
||||
res.send (code or 200), {
|
||||
res.status(code or 200).send {
|
||||
compile:
|
||||
status: status
|
||||
error: error?.message or error
|
||||
|
@ -41,7 +41,7 @@ module.exports = CompileController =
|
|||
clearCache: (req, res, next = (error) ->) ->
|
||||
ProjectPersistenceManager.clearProject req.params.project_id, (error) ->
|
||||
return next(error) if error?
|
||||
res.send 204 # No content
|
||||
res.sendStatus(204) # No content
|
||||
|
||||
syncFromCode: (req, res, next = (error) ->) ->
|
||||
file = req.query.file
|
||||
|
|
|
@ -44,6 +44,7 @@ describe "CompileController", ->
|
|||
}]
|
||||
@RequestParser.parse = sinon.stub().callsArgWith(1, null, @request)
|
||||
@ProjectPersistenceManager.markProjectAsJustAccessed = sinon.stub().callsArg(1)
|
||||
@res.status = sinon.stub().returnsThis()
|
||||
@res.send = sinon.stub()
|
||||
|
||||
describe "successfully", ->
|
||||
|
@ -67,8 +68,9 @@ describe "CompileController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return the JSON response", ->
|
||||
@res.status.calledWith(200).should.equal true
|
||||
@res.send
|
||||
.calledWith(200,
|
||||
.calledWith(
|
||||
compile:
|
||||
status: "success"
|
||||
error: null
|
||||
|
@ -85,8 +87,9 @@ describe "CompileController", ->
|
|||
@CompileController.compile @req, @res
|
||||
|
||||
it "should return the JSON response with the error", ->
|
||||
@res.status.calledWith(500).should.equal true
|
||||
@res.send
|
||||
.calledWith(500,
|
||||
.calledWith(
|
||||
compile:
|
||||
status: "error"
|
||||
error: @message
|
||||
|
@ -102,8 +105,9 @@ describe "CompileController", ->
|
|||
@CompileController.compile @req, @res
|
||||
|
||||
it "should return the JSON response with the timeout status", ->
|
||||
@res.status.calledWith(200).should.equal true
|
||||
@res.send
|
||||
.calledWith(200,
|
||||
.calledWith(
|
||||
compile:
|
||||
status: "timedout"
|
||||
error: @message
|
||||
|
@ -117,8 +121,9 @@ describe "CompileController", ->
|
|||
@CompileController.compile @req, @res
|
||||
|
||||
it "should return the JSON response with the failure status", ->
|
||||
@res.status.calledWith(200).should.equal true
|
||||
@res.send
|
||||
.calledWith(200,
|
||||
.calledWith(
|
||||
compile:
|
||||
error: null
|
||||
status: "failure"
|
||||
|
|
Loading…
Reference in a new issue