Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@zemke/http-mock
Advanced tools
http-mock
Serve JSON mocks conveniently.
// Start server on port 3333.
const httpMock = require('@zemke/http-mock')(3333);
// When http://localhost:3333/api/tournament is requested
// respond with contents of the JSON file under the given path.
httpMock.add('/api/tournament', __dirname + '/mocks/api_tournament.json');
httpMock.add("/api/heythere/1", {hello: "world"});
httpMock.add("/api/blah/1", __dirname + '/1.json');
httpMock.add(/\/api\/else\/(.+)/, __dirname + '/$1.json');
httpMock.add("/api/something", (req, payload) => payload);
add(urlMatcher: string | RegExp, mock: string | object | Function<http.IncomingMessage, object>)
Add a new mock for the given URL pattern. Performs a replace, if the URL pattern already exists.
urlMatcher
— May be a string to match the exact path or a regular expression.
mock
— A path to a JSON file or inline JSON object or a handler function with params http.IncomingMessage
and the POST payload. If urlMatcher
is regular expression, you can do replace operations here (see example above).
clean()
Remove all mocks.
close(Function<>)
Close the server with an optional callback method when the closing errors.
httpMock.add(/\/api\/procedures\/(.+)/, __dirname + '/mocks/$1.json');
FAQs
Serve JSON mocks conveniently.
The npm package @zemke/http-mock receives a total of 1 weekly downloads. As such, @zemke/http-mock popularity was classified as not popular.
We found that @zemke/http-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.