response are captured but never played back
Ali-Dalal opened this issue · 4 comments
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
@Ali-Dalal that's usually because one of the headers, or the body of the request, changes from one to the other. I will try to make a check to inform you in those situations, but for now it simply makes the call again. Can you check?
The ejectCassette is to stop it from recording requests/responses, you should use it otherwise it can have weird behaviour.
@gabrielpoca I've checked it and the problem is from headers.
content-type
is being changed on the response.
closing this then 👍
Thanks for taking the lead, @gabrielpoca