vcr_http: ^0.0.1 copied to clipboard
Store and mock requests made with the http package
📼 VCR (
A package to store and replay requests using the
Getting Started #
Create a client:
VcrClient client = VcrClient(cassettePath: 'cassette_path'); Response response = await client.get('https://api.github.com/users/keviinlouis/repos');
If the cassette file already exists when the
VcrClient is created it will playback and match the requests to the stored requests.
If the cassette file did not already exist it will send and record the http requests.
To use a different cassette create another
Replaying the recorded requests #
Create a new
VcrClient instance with the same
cassette_path. If the cassette file already ex
Using with custom Client #
The recommended way to use VcrClint in combination with a custom Client is to wrap VcrClient with your custom Client. See the implementation of the http package's IOClient for an example on how this is done.