vcr 0.1.0 vcr: ^0.1.0 copied to clipboard
A package to mock requests in tests, storing request in json files and reusing
vcr #
A package to mock requests using Dio Client
Getting Started #
To start using, just create a adapter and put inside your client
This is a example with Dio client:
VcrAdapter adapter = VcrAdapter();
Dio client = Dio();
client.httpClientAdapter = adapter;
After config the adapter, you now can use a cassette
adapter.useCassette('github/user_repos');
Response response = await client.get('https://api.github.com/users/keviinlouis/repos');
expect(response.statusCode, 200);
Now the request is stored in test/cassette/github/user_repos.json
If you have multiple requests for one test, they will be added in a list of requests If de adapter can't find the right request, he will make a normal request and then store the request
This package is inspired by VCR gem
Next Features
- ❌ Work with Http Package