mikeal/jaws — pull request #4 by acstll (2013-07-20 14:55:48+00:00)
Title: Application#condition now handles status code and callback arguments cor...

...rectly.

If you do this `condition(statusCode, cb)`, as in the README examples:

.condition(401, function (req, resp, cb) {
req.on('condition.auth', function (e, user) {
if (req.user.id !== req.routes.params.userid) return cb('You can only access your own user document.')
cb(null, user)
})
})

The 401 status code is ignored and 500 gets sent instead.

This commit corrects that.
Not completely happy about the logic, but it works.