Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
axios-etag-cache
Advanced tools
Axios etag interceptor to enable If-None-Match request with ETAG support
Axios etag interceptor to enable If-None-Match request with ETAG support
const axios = require('axios');
const { axiosETAGCache } = require('axios-etag-cache');
// Apply the axios ETAG interceptor
const axiosWithETAGCache = axiosETAGCache(axios);
axiosWithETAGCache
.get('http://example.com')
.then(console.log)
.catch(console.error);
const axiosWithETAGCache = axiosETAGCache(axios, {enablePost: true});
Example implementation using RXDB
import { axiosETAGCache, BaseCache, CacheValue } from "axios-etag-cache";
const cacheSchema = {
title: "response cache schema",
version: 4,
primaryKey: {
key: "url",
fields: ["url"],
separator: "|",
},
type: "object",
properties: {
url: {
type: "string", maxLength: 100,
},
etag: {type: "string"},
lastHitAt: {type: "number"},
createdAt: {type: "number"},
value: {type: "object"}
},
required: ["url", "etag", "value"],
indexes: ["url"]
}
class RxDBStorageCache extends BaseCache {
flushAll(): any {
}
async get(key: string): Promise<CacheValue | undefined> {
const cache = (
await db["responseCache"].findOne({
selector: {url: key},
}).exec())?.toJSON();
if (cache) {
const payload: CacheValue = {
value: cache.value,
etag: cache.etag,
createdAt: cache.createdAt,
lastHitAt: cache.lastHitAt
} as CacheValue;
return payload;
}
return undefined;
}
set(key: string, value: CacheValue): any {
db["responseCache"].upsert({
url: key,
value: value.value,
etag: value.etag,
createdAt: value.createdAt,
lastHitAt: value.lastHitAt,
});
}
}
const axiosWithETAGCache = axiosETAGCache(axios, {cacheClass: RxDBStorageCache});
FAQs
Axios etag interceptor to enable If-None-Match request with ETAG support
The npm package axios-etag-cache receives a total of 998 weekly downloads. As such, axios-etag-cache popularity was classified as not popular.
We found that axios-etag-cache 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.