
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@growflow/axios-vcr
Advanced tools
:vhs: Record and Replay requests in JavaScript
axios-vcr is a set of axios middlewares that allow you to record and replay axios requests. Use it for reliable, fast and more deterministic tests.
$ npm install --save-dev axios-vcr
Using axios-vcr is very simple. All you need to do is to provide a cassette path and wrap your axios code with axiosVCR.mountCassette
and axiosVCR.ejectCassette
.
const axiosVCR = require('axios-vcr');
axiosVCR.mountCassette('./test/fixtures/cats.json')
axios.get('https://reddit.com/r/cats.json').then(response => {
// axios-vcr will store the remote response from /cats.json
// in ./test/fixtures/cats.json
// Subsequent requests will then load the response directly from the file system
axiosVCR.ejectCassette('https://reddit.com/r/cats.json')
})
it('makes your requests load faster and more reliably', function(done) {
// mount a cassette
axiosVCR.mountCassette('./fixtures/test_case_name.json')
myAPI.fetchSomethingFromRemote().then(function(response) {
assert.equal(response.something, 'some value')
done()
// Eject the cassette when all your promises have been fulfilled
axiosVCR.ejectCassette('./fixture/test_case_name.json')
})
})
Bug reports and pull requests are welcome on GitHub at https://github.com/nettofarah/axios-vcr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Code of Conduct.
To run the specs check out the repo and follow these steps:
$ npm install
$ npm test
The module is available as open source under the terms of the MIT License.
1.0.2 (Sep 14, 2019)
axios
0.19.0FAQs
Forked axios-vcr to support XML payloads.
The npm package @growflow/axios-vcr receives a total of 0 weekly downloads. As such, @growflow/axios-vcr popularity was classified as not popular.
We found that @growflow/axios-vcr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.