use_cassette {vcr} | R Documentation |
Use a cassette to record HTTP requests
Description
use_cassette(...)
uses a cassette for the code in ...
;
local_cassette()
uses a cassette for the current function scope (e.g.
for one test). Learn more in vignette("vcr")
.
Note that defaults for most arguments are controlled by vcr_configure()
,
so you may want to use that instead if you are changing the defaults for
all cassettes.
Usage
use_cassette(
name,
...,
dir = NULL,
record = NULL,
match_requests_on = NULL,
serialize_with = NULL,
preserve_exact_body_bytes = NULL,
re_record_interval = NULL,
warn_on_empty = NULL
)
local_cassette(
name,
dir = NULL,
record = NULL,
match_requests_on = NULL,
serialize_with = NULL,
preserve_exact_body_bytes = NULL,
re_record_interval = NULL,
warn_on_empty = NULL,
frame = parent.frame()
)
Arguments
name |
The name of the cassette. This is used to name a file on disk, so it must be valid file name. |
... |
a block of code containing one or more requests (required). Use
curly braces to encapsulate multi-line code blocks. If you can't pass a code
block use |
dir |
The directory where the cassette will be stored. Defaults to
|
record |
Record mode that dictates how HTTP requests/responses are recorded. Possible values are:
|
match_requests_on |
Character vector of request matchers used to
determine which recorded HTTP interaction to replay. The default matches
on the The full set of possible values are:
If more than one is specified, all components must match in order for the
request to match. If not supplied, defaults to Note that the request header and body will only be included in the
cassette if |
serialize_with |
(string) Which serializer to use:
|
preserve_exact_body_bytes |
(logical) Force a binary (base64)
representation of the request and response bodies? By default, vcr
will look at the |
re_record_interval |
(integer) How frequently (in seconds) the
cassette should be re-recorded. Default: |
warn_on_empty |
(logical) Warn if the cassette is ejected but no interactions
have been recorded. Default: |
frame |
Attach exit handlers to this environment. Typically, this
should be either the current environment or a parent frame (accessed
through |
See Also
insert_cassette()
and eject_cassette()
for the underlying
functions.