replace deprecated send(code,body) calls
This commit is contained in:
@@ -84,7 +84,7 @@ if Settings.smokeTest
|
|||||||
|
|
||||||
app.get "/health_check", (req, res)->
|
app.get "/health_check", (req, res)->
|
||||||
res.contentType(resCacher?.setContentType)
|
res.contentType(resCacher?.setContentType)
|
||||||
res.send resCacher?.code, resCacher?.body
|
res.status(resCacher?.code).send(resCacher?.body)
|
||||||
|
|
||||||
profiler = require "v8-profiler"
|
profiler = require "v8-profiler"
|
||||||
app.get "/profile", (req, res) ->
|
app.get "/profile", (req, res) ->
|
||||||
@@ -101,7 +101,7 @@ app.get "/heapdump", (req, res)->
|
|||||||
|
|
||||||
app.use (error, req, res, next) ->
|
app.use (error, req, res, next) ->
|
||||||
logger.error err: error, "server error"
|
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) ->
|
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}"
|
logger.info "CLSI starting up, listening on #{host}:#{port}"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = CompileController =
|
|||||||
status = "success"
|
status = "success"
|
||||||
|
|
||||||
timer.done()
|
timer.done()
|
||||||
res.send (code or 200), {
|
res.status(code or 200).send {
|
||||||
compile:
|
compile:
|
||||||
status: status
|
status: status
|
||||||
error: error?.message or error
|
error: error?.message or error
|
||||||
@@ -41,7 +41,7 @@ module.exports = CompileController =
|
|||||||
clearCache: (req, res, next = (error) ->) ->
|
clearCache: (req, res, next = (error) ->) ->
|
||||||
ProjectPersistenceManager.clearProject req.params.project_id, (error) ->
|
ProjectPersistenceManager.clearProject req.params.project_id, (error) ->
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
res.send 204 # No content
|
res.sendStatus(204) # No content
|
||||||
|
|
||||||
syncFromCode: (req, res, next = (error) ->) ->
|
syncFromCode: (req, res, next = (error) ->) ->
|
||||||
file = req.query.file
|
file = req.query.file
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ describe "CompileController", ->
|
|||||||
}]
|
}]
|
||||||
@RequestParser.parse = sinon.stub().callsArgWith(1, null, @request)
|
@RequestParser.parse = sinon.stub().callsArgWith(1, null, @request)
|
||||||
@ProjectPersistenceManager.markProjectAsJustAccessed = sinon.stub().callsArg(1)
|
@ProjectPersistenceManager.markProjectAsJustAccessed = sinon.stub().callsArg(1)
|
||||||
|
@res.status = sinon.stub().returnsThis()
|
||||||
@res.send = sinon.stub()
|
@res.send = sinon.stub()
|
||||||
|
|
||||||
describe "successfully", ->
|
describe "successfully", ->
|
||||||
@@ -67,8 +68,9 @@ describe "CompileController", ->
|
|||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should return the JSON response", ->
|
it "should return the JSON response", ->
|
||||||
|
@res.status.calledWith(200).should.equal true
|
||||||
@res.send
|
@res.send
|
||||||
.calledWith(200,
|
.calledWith(
|
||||||
compile:
|
compile:
|
||||||
status: "success"
|
status: "success"
|
||||||
error: null
|
error: null
|
||||||
@@ -85,8 +87,9 @@ describe "CompileController", ->
|
|||||||
@CompileController.compile @req, @res
|
@CompileController.compile @req, @res
|
||||||
|
|
||||||
it "should return the JSON response with the error", ->
|
it "should return the JSON response with the error", ->
|
||||||
|
@res.status.calledWith(500).should.equal true
|
||||||
@res.send
|
@res.send
|
||||||
.calledWith(500,
|
.calledWith(
|
||||||
compile:
|
compile:
|
||||||
status: "error"
|
status: "error"
|
||||||
error: @message
|
error: @message
|
||||||
@@ -102,8 +105,9 @@ describe "CompileController", ->
|
|||||||
@CompileController.compile @req, @res
|
@CompileController.compile @req, @res
|
||||||
|
|
||||||
it "should return the JSON response with the timeout status", ->
|
it "should return the JSON response with the timeout status", ->
|
||||||
|
@res.status.calledWith(200).should.equal true
|
||||||
@res.send
|
@res.send
|
||||||
.calledWith(200,
|
.calledWith(
|
||||||
compile:
|
compile:
|
||||||
status: "timedout"
|
status: "timedout"
|
||||||
error: @message
|
error: @message
|
||||||
@@ -117,8 +121,9 @@ describe "CompileController", ->
|
|||||||
@CompileController.compile @req, @res
|
@CompileController.compile @req, @res
|
||||||
|
|
||||||
it "should return the JSON response with the failure status", ->
|
it "should return the JSON response with the failure status", ->
|
||||||
|
@res.status.calledWith(200).should.equal true
|
||||||
@res.send
|
@res.send
|
||||||
.calledWith(200,
|
.calledWith(
|
||||||
compile:
|
compile:
|
||||||
error: null
|
error: null
|
||||||
status: "failure"
|
status: "failure"
|
||||||
|
|||||||
Reference in New Issue
Block a user