Skip to contents

List cassettes, get current cassette, etc.

Usage

cassettes()

current_cassette()

cassette_path()

Details

  • cassettes(): returns cassettes all active cassettes in the current session.

  • current_cassette(): returns NULL when no cassettes are in use; returns the current cassette (a Cassette object) when one is in use

  • cassette_path(): returns the current directory path where cassettes will be stored

Examples

vcr_configure(dir = tempdir())

# list all cassettes
cassettes()
#> list()

# list the currently active cassette
insert_cassette("stuffthings")
current_cassette()
#> <vcr - Cassette> stuffthings
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   Re-record interval (s): 
#>   Clean outdated interactions?: FALSE
#>   allow_playback_repeats: FALSE
#>   preserve_exact_body_bytes: FALSE
cassettes()
#> $stuffthings
#> <vcr - Cassette> stuffthings
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   Re-record interval (s): 
#>   Clean outdated interactions?: FALSE
#>   allow_playback_repeats: FALSE
#>   preserve_exact_body_bytes: FALSE
#> 

eject_cassette()
#> Warning: Empty cassette (stuffthings) deleted; consider the following:
#>  - If an error occurred resolve that first, then check:
#>  - vcr only supports crul, httr & httr2; requests w/ curl, download.file, etc. are not supported
#>  - If you are using crul/httr/httr2, are you sure you made an HTTP request?
cassettes()
#> list()


# list the path to cassettes
cassette_path()
#> [1] "/tmp/RtmpGy8xhc"
vcr_configure(dir = file.path(tempdir(), "foo"))
cassette_path()
#> [1] "/tmp/RtmpGy8xhc/foo"

vcr_configure_reset()