Gathering detailed insights and metrics for http-assert
Gathering detailed insights and metrics for http-assert
Gathering detailed insights and metrics for http-assert
Gathering detailed insights and metrics for http-assert
npm install http-assert
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99
Supply Chain
97.7
Quality
79
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
380,789,461
Last Day
623,576
Last Week
3,207,497
Last Month
13,054,283
Last Year
121,832,855
MIT License
154 Stars
143 Commits
15 Forks
12 Watchers
1 Branches
28 Contributors
Updated on Mar 12, 2025
Minified
Minified + Gzipped
Latest Version
1.5.0
Package Id
http-assert@1.5.0
Size
3.06 kB
NPM Version
7.11.2
Node Version
16.1.0
Published on
Aug 25, 2021
Cumulative downloads
Total Downloads
Last Day
1.5%
623,576
Compared to previous day
Last Week
15%
3,207,497
Compared to previous week
Last Month
4.6%
13,054,283
Compared to previous month
Last Year
73.7%
121,832,855
Compared to previous year
Assert with status codes. Like ctx.throw() in Koa, but with a guard.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
1$ npm install http-assert
1var assert = require('http-assert') 2var ok = require('assert') 3 4var username = 'foobar' // username from request 5 6try { 7 assert(username === 'fjodor', 401, 'authentication failed') 8} catch (err) { 9 ok(err.status === 401) 10 ok(err.message === 'authentication failed') 11 ok(err.expose) 12}
The API of this module is intended to be similar to the
Node.js assert
module.
Each function will throw an instance of HttpError
from
the http-errors
module
when the assertion fails.
Tests if value
is truthy. If value
is not truthy, an HttpError
is thrown that is constructed with the given status
, message
,
and properties
.
Tests for deep equality between a
and b
. Primitive values are
compared with the Abstract Equality Comparison (==
). If a
and b
are not equal, an HttpError
is thrown that is constructed with the
given status
, message
, and properties
.
Tests shallow, coercive equality between a
and b
using the Abstract
Equality Comparison (==
). If a
and b
are not equal, an HttpError
is thrown that is constructed with the given status
, message
,
and properties
.
Always throws an HttpError
that is constructed with the given status
,
message
, and properties
.
Tests for deep equality between a
and b
. Primitive values are
compared with the Abstract Equality Comparison (==
). If a
and b
are equal, an HttpError
is thrown that is constructed with the given
status
, message
, and properties
.
Tests shallow, coercive equality between a
and b
using the Abstract
Equality Comparison (==
). If a
and b
are equal, an HttpError
is
thrown that is constructed with the given status
, message
, and
properties
.
Tests strict equality between a
and b
as determined by the SameValue
Comparison (===
). If a
and b
are equal, an HttpError
is thrown
that is constructed with the given status
, message
, and properties
.
Tests if value
is truthy. If value
is not truthy, an HttpError
is thrown that is constructed with the given status
, message
,
and properties
.
Tests strict equality between a
and b
as determined by the SameValue
Comparison (===
). If a
and b
are not equal, an HttpError
is thrown that is constructed with the given status
, message
,
and properties
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More