|
hace 5 años | |
---|---|---|
.. | ||
node_modules | hace 5 años | |
HISTORY.md | hace 5 años | |
LICENSE | hace 5 años | |
index.js | hace 5 años | |
package.json | hace 5 años | |
readme.md | hace 5 años |
#http-assert
Assert with status codes. Like ctx.throw() in Koa, but with a guard.
##Example
var assert = require('http-assert');
var ok = require('assert');
try {
assert(username == 'fjodor', 401, 'authentication failed');
} catch (err) {
ok(err.status == 401);
ok(err.message == 'authentication failed');
ok(err.expose);
}
##Licence MIT