diff --git a/lib/context.js b/lib/context.js index 97dac5a..cdaf153 100644 --- a/lib/context.js +++ b/lib/context.js @@ -7,7 +7,6 @@ const util = require('util'); const createError = require('http-errors-lite'); -const httpAssert = require('http-assert'); const delegate = require('./delegates'); const statuses = require('./statuses'); @@ -59,15 +58,17 @@ const proto = module.exports = { * * this.assert(this.user, 401, 'Please login!'); * - * See: https://github.com/jshttp/http-assert - * * @param {Mixed} test * @param {Number} status * @param {String} message * @api public */ - assert: httpAssert, + assert: function(test, status, message, props) { + if (!test) { + this.throw(status, message, props) + } + }, /** * Throw an error with `status` (default 500) and diff --git a/package.json b/package.json index 59066bc..de799f9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "error-inject": "^1.0.0", "escape-html": "^1.0.3", "fresh": "~0.5.2", - "http-assert": "^1.3.0", "http-errors-lite": "^2.0.2", "koa-compose": "^4.1.0", "koa-is-json": "^1.0.0",