
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
http-assert
Advanced tools
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:
$ npm install http-assert
var assert = require('http-assert')
var ok = require('assert')
var username = 'foobar' // username from request
try {
assert(username === 'fjodor', 401, 'authentication failed')
} catch (err) {
ok(err.status === 401)
ok(err.message === 'authentication failed')
ok(err.expose)
}
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.
The 'assert' module is a simple assertion library that comes with Node.js. It provides basic assertion tests and is used primarily for testing. Unlike 'http-assert', it does not automatically map assertions to HTTP error codes.
Chai-http is an assertion library that can be used with the Chai assertion library for HTTP server testing. It provides a more fluent API for testing HTTP servers and includes assertions specifically designed for HTTP interactions. It is more feature-rich compared to 'http-assert' but also more complex.
Supertest is a library for testing Node.js HTTP servers. It provides a high-level abstraction for testing HTTP, while allowing you to assert the HTTP response. It is not an assertion library per se, but it integrates well with assertion libraries to provide a full testing solution.
FAQs
assert with status codes
The npm package http-assert receives a total of 3,449,995 weekly downloads. As such, http-assert popularity was classified as popular.
We found that http-assert demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.