Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
request-etag
Advanced tools
Small, in-memory, ETag-based, HTTP-response-caching module. It is based on the two following popular NPM packages,
request-etag
constructor.Configuration,
var cacheConfig = {
max: 10 * 1024 * 1024
};
A default length
function is injected into the cache object by request-etag
. It returns the sum of the length of the key, and the length of the value as JSON.
More details on the cache configuration options can be found on the lru-cache webpage.
var ETagRequest = require('request-etag');
var eTagRequest = new ETagRequest(cacheConfig);
The ETagRequest
constructor takes a second optional argument which specifies the underlying HTTP request client to use. It defaults to request, so the above constructor call is equivalent to,
var eTagRequest = new ETagRequest(cacheConfig, require('request'));
Note that the signature of the underlying HTTP request client function MUST be the same as that of request (e.g. requestretry).
The first GET request will be sent without an If-None-Match
header, and its response will contain a body.
eTagRequest('www.immutablepage.com', function (error, response, body) {
if (!error && response.statusCode === 200) {
console.log('Received 200 - body retrieved from response.');
console.log(body);
}
if (!error && response.statusCode === 304) {
console.log('Received 304 - body retrieved from cache.')
console.log(body);
}
});
Subsequent GET requests to the same URL will be sent with an If-None-Match
header. The response code will be 304, and the response will not contain a body. However a body will be passed by the cache to the body
parameter of the callback function.
Situations where the request response is not cached include,
Please run the following commands before submitting a pull-request,
npm run lint
npm run code-style
npm run test
FAQs
Small, ETag-based, HTTP-response-caching module
We found that request-etag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.