
Security News
CISA Extends MITRE Contract as Crisis Accelerates Alternative CVE Coordination Efforts
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
@eis/fetchutils
Advanced tools
fetchutils
is a wrapper around Javascript's fetch API that attempts to solve a few common issues:
interface Book {
id: string;
title: string;
author: string;
}
const client = new HttpClient('http://example.com', {
headers: { authorization: "Bearer <token>" }
})
async function doStuff() {
try {
// Pass the expected type of the return value.
// No need to call response.json() or check response.ok here.
const books = await client.get<Book[]>('/books');
// Access the result
books.forEach(book=> {
console.log('id', book.id);
console.log('author', book.author);
console.log('title', book.title);
});
} catch (e: unknown) {
// get() will wrap any non-2xx status codes and throw an instance
// of HttpError. If the response body was a json object, the message
// will be the serialized json value. Otherwise, the body text or
// the http status text is returned.
if (e instanceof HttpError){
console.log(`Error ${e.code}: ${e.message}`);
}
throw e;
}
}
POST
interface Book {
id: string;
title: string;
author: string;
}
const client = new HttpClient('http://example.com', {
headers: { authorization: "Bearer <token>" }
})
async function doStuff() {
try {
// you can call post() like this:
// const books = await client.post<Book>('/books', {
// body: JSON.stringify({
// title: 'my new book',
// author: 'myself',
// })
// });
// or you can call the postJson() shortcut:
const book = await client.postJson<Book>('/books', {
title: 'my new book',
author: 'myself',
});
// you can also postJson() without a response:
// await client.postJson('/books', {
// title: 'my new book',
// author: 'myself',
// });
console.log(`Created book ${book.id}`)
} catch (e: unknown) {
// ...
}
}
There are similar APIs for PUT and DELETE requests.
FAQs
A typescript wrapper for the fetch API
The npm package @eis/fetchutils receives a total of 6 weekly downloads. As such, @eis/fetchutils popularity was classified as not popular.
We found that @eis/fetchutils 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
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.