JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3561484
  • Score
    100M100P100Q205651F
  • License MIT

assert with status codes

Package Exports

  • http-assert

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-assert) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#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', 400, 'wrong user');
} catch (err) {
  ok(err.status == 400);
  ok(err.message == 'wrong user');
  ok(err.expose);
}

##Licence MIT