Remove http-assert and replace it with just a simple function :)

This commit is contained in:
Jonatan Nilsson 2019-10-11 16:57:01 +00:00
parent dd35564df4
commit fad4d10057
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,6 @@
const util = require('util'); const util = require('util');
const createError = require('http-errors-lite'); const createError = require('http-errors-lite');
const httpAssert = require('http-assert');
const delegate = require('./delegates'); const delegate = require('./delegates');
const statuses = require('./statuses'); const statuses = require('./statuses');
@ -59,15 +58,17 @@ const proto = module.exports = {
* *
* this.assert(this.user, 401, 'Please login!'); * this.assert(this.user, 401, 'Please login!');
* *
* See: https://github.com/jshttp/http-assert
*
* @param {Mixed} test * @param {Mixed} test
* @param {Number} status * @param {Number} status
* @param {String} message * @param {String} message
* @api public * @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 * Throw an error with `status` (default 500) and

View file

@ -29,7 +29,6 @@
"error-inject": "^1.0.0", "error-inject": "^1.0.0",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"fresh": "~0.5.2", "fresh": "~0.5.2",
"http-assert": "^1.3.0",
"http-errors-lite": "^2.0.2", "http-errors-lite": "^2.0.2",
"koa-compose": "^4.1.0", "koa-compose": "^4.1.0",
"koa-is-json": "^1.0.0", "koa-is-json": "^1.0.0",