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
80.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
155 Stars
146 Commits
18 Forks
12 Watchers
10 Branches
29 Contributors
Updated on Jun 06, 2025
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
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
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
GitHub workflow tokens follow principle of least privilege
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 6
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 3/29 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
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