nettofarah / axios-vcr Goto Github PK
View Code? Open in Web Editor NEW:vhs: Record and Replay requests in JavaScript
License: MIT License
:vhs: Record and Replay requests in JavaScript
License: MIT License
First of all, thanks for this super useful library.
I'm experiencing an issue. The cassette is never being used (although it is created when requesting without a previous casette).
Is it possible that when there is no casette, the digest is being calculated based on the response instead of the request? but then it checks the hash against the digest of the request.
In my case, headers of the request are different from the response, that's why i think this is the case, but i may be using it in a wrong way.
If you confirm the issue, i can contribute in resolving it.
Thank you
I have this test case
it('should create a product', async () => {
axiosVCR.mountCassette('./cassette/product/create.json');
let create = await product.create(productName,type_id);
product_id= create.id;
expect(create).to.be.instanceOf(Object).and.have.property('product_id').that.equals(temp_product_id);
});
I can see the request has been recorded under my files tree but when I try to run the test again, it fetches the real API.
Note: product.create uses axios in order to fetch the data.
Also, what's the idea of axiosVCR.ejectCassette
?
Thanks
Hello,
So this is really an interoperability question. Axios-VCR works and works well. Would be a good addition to community if was able to get a setup for it with webpack.
When I add axios-vcr to a project where I am using webpack I get an error related to fs
not being defined. That is related to the fs being stubbed out by webpack.
I tried with target: "node"
, which runs your project as if it were in a node-server setup but then get something related to process
not being found, when i define the process i end up going down a rabbit hole of other issues.
Do you have any recommendations for a setup for this to allow axios-vcr access to fs for read/write but keep everything else in the project working as is?
Thanks so much for axios-vcr and any help!
The README says
All you need to do is [...] wrap your axios code in a VCR.use call.
and then the example code didn't use any code like that, VCR.use
?
I assume this is due to API changes.
Is it bounding by mountCassette
and ejectCassette
instead these days?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.