
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-callapi
Advanced tools
Making api call with node-fetch, with middleware.
const Caller = require('node-callapi');
const caller = new Caller(setting);
caller.call(endpoint, options)
new Caller(options);
options.middlewaresmiddlewares will be applied after every request finished.
a middleware is an async function, it recevied an object. and returns a object that has the shape same as received data.
async function middleware(data) {
const {
// fetch options
fetchOptions,
// the endpoint
url,
// response, if no response, it will be null
response,
// the request duration
duration,
// if any error occured, it will be an Error instance
error,
// the result data, it will be one of [array, object, string, null]
data,
} = data;
// do something
return result;
}
data.error| name | description |
|---|---|
error.status | the response status |
error.fetchOptions | the fetch options |
error.duration | the time of the fetch request processing time |
error.data | the data from server, it will parsed even if request failed |
error.response | the full response object |
error.url | the fetch url |
url should use absolute url.
it will return the parsed result.
options.method(optional)request method. should be one of ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'TRACE', 'HEAD', 'CONNECT'].
options.datasend data to server if use 'POST', 'PUT' method.
options.middlewaresappend middlewares. should be a valid middleware.
options.headersappend headers. should be an key-value object.
FAQs
Making api call with node-fetch, with middleware.
We found that node-callapi 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.