25 Record modes
Record modes dictate under what circumstances http requests/responses are
recorded to cassettes (disk). Set the recording mode with the parameter
record
in the use_cassette()
and insert_cassette()
functions.
25.1 once
The once
record mode will:
- Replay previously recorded interactions.
- Record new interactions if there is no cassette file.
- Cause an error to be raised for new requests if there is a cassette file.
It is similar to the new_episodes
record mode, but will prevent new,
unexpected requests from being made (i.e. because the request URI changed
or whatever).
once
is the default record mode, used when you do not set one.
25.2 none
The none
record mode will:
- Replay previously recorded interactions.
- Cause an error to be raised for any new requests.
This is useful when your code makes potentially dangerous
HTTP requests. The none
record mode guarantees that no
new HTTP requests will be made.
25.3 new_episodes
The new_episodes
record mode will:
- Record new interactions.
- Replay previously recorded interactions.
It is similar to the once
record mode, but will always record new
interactions, even if you have an existing recorded one that is similar
(but not identical, based on the match_request_on
option).