|
пре 5 година | |
---|---|---|
.. | ||
node_modules | пре 5 година | |
HISTORY.md | пре 5 година | |
LICENSE | пре 5 година | |
index.js | пре 5 година | |
package.json | пре 5 година | |
readme.md | пре 5 година |
#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