mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Proofed admin endpoint some more, no more dangling connections
This commit is contained in:
parent
8969311d82
commit
ebfe1fc1c0
2 changed files with 15 additions and 2 deletions
|
@ -20,7 +20,9 @@ module.exports.setup = (app) ->
|
|||
name = handlers[moduleName]
|
||||
handler = require('../' + name)
|
||||
|
||||
return errors.notFound res, 'Handler not found for ' + moduleName unless handler
|
||||
return handler[parts[1]](req, res, parts[2..]...) if parts[1] of handler
|
||||
return errors.notFound res, 'Method not found for handler ' + name
|
||||
|
||||
catch error
|
||||
log.error("Error trying db method '#{req.route.method}' route '#{parts}' from #{name}: #{error}")
|
||||
|
|
|
@ -15,9 +15,20 @@ describe 'recalculate statistics', ->
|
|||
expect(res.statusCode).toBe 202
|
||||
done()
|
||||
|
||||
it 'responds with a 404 when not found', (done) ->
|
||||
xit 'responds with a 404 if handler not found', (done) ->
|
||||
loginAdmin ->
|
||||
request.post {uri:getURL '/admin/blobfish/swim'}, (err, res, body) ->
|
||||
expect(res.statusCode).toBe 404
|
||||
done()
|
||||
|
||||
it 'responds with a 404 if handler method not found', (done) ->
|
||||
loginAdmin ->
|
||||
request.post {uri:getURL '/admin/user/hammertime'}, (err, res, body) ->
|
||||
expect(res.statusCode).toBe 404
|
||||
done()
|
||||
|
||||
it 'responds with a 404 if recalculate method not found', (done) ->
|
||||
loginAdmin ->
|
||||
request.post {uri:url + 'ballsKicked'}, (err, res, body) ->
|
||||
expect(res.statusCode).toBe 404
|
||||
done()
|
||||
|
||||
|
|
Loading…
Reference in a new issue