
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.
simple-fetch
Advanced tools
a simple wrapper around cross-fetch to make it easier to work with common fetch tasks
This is only meant for more convenient basic JSON requests. Please use the fetch API for more complex use cases.
By default, HTTP response codes other than 2xx will cause the fetch promise handler to throw. To change this behavior, set opts.only2xx = false.
const simpleFetch = require('simple-fetch');
const { getJson, postJson } = simpleFetch;
getJson('https://myapi.com/events')
.then(function (events) {
console.log(events);
});
const response = await postJson('https://myapi.com/events', {
name: 'New Event',
date: 'tomorrow'
}, {
headers: {
Authorization: `Bearer ${token}`
}
});
simpleFetch('patch', 'https://myapi.com/events/1', {
name: 'Other Event',
date: 'next Sunday'
}).then(...)
If common options, such as headers, need to be passed to all methods, use createFetch:
const { createFetch } = require('simple-fetch');
const { getJson, deleteJson } = createFetch({
headers: {
Authorization: `Bearer ${token}`
}
});
await getJson('https://myauthenticatedapi.com/events');
await deleteJson('https://myauthenticatedapi.com/events/2');
simpleFetch(method, url[, data][, opts]).getJson(url[, opts]).postJson(url, data[, opts]).putJson(url, data[, opts]).patchJson(url, data[, opts]).deleteJson(url[, opts])data can be an object, array or JSON stringopts.only2xx: if set to false, will not throw error even for error codes other than 2xx. Defaults to true.opts.skipParsing: skip parsing of response into JSON, will return the Response object directly. Defaults to false.FAQs
Simple and minimal wrapper around fetch API for JSON requests
The npm package simple-fetch receives a total of 80 weekly downloads. As such, simple-fetch popularity was classified as not popular.
We found that simple-fetch 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.