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%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
334,618,592
Last Day
544,034
Last Week
2,439,430
Last Month
10,302,166
Last Year
96,701,591
152 Stars
143 Commits
15 Forks
13 Watching
1 Branches
30 Contributors
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
Publised On
25 Aug 2021
Cumulative downloads
Total Downloads
Last day
4.2%
544,034
Compared to previous day
Last week
-10.3%
2,439,430
Compared to previous week
Last month
9.6%
10,302,166
Compared to previous month
Last year
37.8%
96,701,591
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 binaries found in the repo
Reason
no dangerous workflow patterns detected
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
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
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-01-27
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