
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
![]()
Record XMLHttpRequest calls and saves them using localStorage or files if using Nodejs. It's a js implementation of myronmarston's VCR but for javasccript without any dependencies
$ npm install vcr
VCR.configure(function(c) {
c.hookInto = window.XMLHttpRequest;
c.cassetteLibraryDir = "recorder"; // default: 'cassettes'
c.host = "http://localhost:9393/"; // will prepend req url
});
The only required config it's wich object to intercept, for now only works with XMLHttpRequest to catch ajax requests.
hookInto: object to intercept cassetteLibraryDir: when using nodejs defines where to store cassettes host: usefull when running within node and want to cache request to save, destroy, update, etc.
I try to make it as similar to original VCR as possible. Using Gerbil it's something like this:
scenario("Ajax interception", {
'setup': function() {
VCR.configure(function(c) {
c.hookInto = window.XMLHttpRequest;
});
},
'Recording ajax request': function(g) {
VCR.useCassette('test', function(v) {
XMLHttpRequest = v.XMLHttpRequest;
var makeRequest = function() {
var ajax = new XMLHttpRequest();
ajax.open('GET', 'test.html');
ajax.onreadystatechange = function() {
if(ajax.readyState === 4) {
g.assertEqual("Hello World!\n", ajax.responseText);
}
};
ajax.send(null);
}
// Record First Request
makeRequest();
// Wait for it...
g.setTimeout(function() { makeRequest(); }, 100);
});
}
});
If you are using nodejs .json files will be created as cassetes to reproduce afterwards. In the other hand if you are running it in a browser localStorage will be used to persist the recordings.
Pablo Dejuan for the idea.
FAQs
VCR: Record ajax request to later playback
We found that vcr 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.