File: vcr_configure.Rd

package info (click to toggle)
r-cran-vcr 0.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 596 kB
  • sloc: sh: 13; makefile: 2
file content (127 lines) | stat: -rw-r--r-- 4,581 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/configuration.R
\name{vcr_configure}
\alias{vcr_configure}
\alias{vcr_configure_reset}
\alias{vcr_configuration}
\alias{vcr_config_defaults}
\title{Configuration}
\usage{
vcr_configure(dir = ".", record = "once",
  match_requests_on = c("method", "uri"),
  allow_unused_http_interactions = TRUE, serialize_with = "yaml",
  persist_with = "FileSystem", ignore_hosts = NULL,
  ignore_localhost = FALSE, ignore_request = NULL,
  uri_parser = "crul::url_parse", preserve_exact_body_bytes = FALSE,
  turned_off = FALSE, ignore_cassettes = FALSE,
  re_record_interval = NULL, clean_outdated_http_interactions = NULL,
  allow_http_connections_when_no_cassette = FALSE, cassettes = list(),
  linked_context = NULL, log = FALSE, log_opts = list(file =
  "vcr.log", log_prefix = "Cassette", date = TRUE),
  filter_sensitive_data = NULL)

vcr_configure_reset()

vcr_configuration()

vcr_config_defaults()
}
\arguments{
\item{dir}{Cassette directory}

\item{record}{(character) One of 'all', 'none', 'new_episodes', or 'once'.
See \link{recording}}

\item{match_requests_on}{vector of matchers. Default: (\code{method}, \code{uri})
See \link{request-matching} for details.}

\item{allow_unused_http_interactions}{(logical) Default: \code{TRUE}}

\item{serialize_with}{(character) only option is "yaml"}

\item{persist_with}{(character) only option is "FileSystem"}

\item{ignore_hosts}{(character) Vector of hosts to ignore. e.g., localhost, or
google.com. These hosts are ignored and real HTTP requests allowed to go
through}

\item{ignore_localhost}{(logical) Default: \code{FALSE}}

\item{ignore_request}{List of requests to ignore}

\item{uri_parser}{the uri parser, default: \code{\link[crul:url_parse]{crul::url_parse()}}}

\item{preserve_exact_body_bytes}{(logical) preserve exact body bytes for}

\item{turned_off}{(logical) VCR is turned on by default. Default:
\code{FALSE}}

\item{ignore_cassettes}{(logical) Ignore cassettes. You can set this to
\code{TRUE} when you don't have a cassette in use but still want to make
HTTP requests. Otherwise, you can't make requests unless a cassette is in
use. Default: \code{FALSE}}

\item{re_record_interval}{(numeric) When given, the cassette will be
re-recorded at the given interval, in seconds.}

\item{clean_outdated_http_interactions}{(logical) Should outdated interactions
be recorded back to file. Default: \code{FALSE}}

\item{allow_http_connections_when_no_cassette}{(logical) Determines how vcr
treats HTTP requests that are made when no vcr cassette is in use. When
\code{TRUE}, requests made when there is no vcr cassette in use will be allowed.
When \code{FALSE} (default), an \link{UnhandledHTTPRequestError} error will be raised
for any HTTP request made when there is no cassette in use}

\item{cassettes}{(list) don't use}

\item{linked_context}{(logical) linked context}

\item{log}{(logical) should we log important vcr things? Default: \code{FALSE}}

\item{log_opts}{(list) Additional logging options. Options include:
\itemize{
\item file: one of a file path to log to or "console"
\item log_prefix: default: "Cassette". We insert the cassette name after
that prefix, then the rest of the message
\item more to come
}}

\item{filter_sensitive_data}{(list) named list of values to replace. format
is: \code{list(thing_to_replace = thing_to_replace_it_with)}. We replace all
instances of \code{thing_to_replace} with \code{thing_to_replace_it_with}. Before
recording (writing to a cassette) we do the replacement and then when
reading from the cassette we do the reverse replacement to get back
to the real data. Before record replacement happens in internal
function \code{write_interactions()}, while before playback replacement
happens in internal function \code{YAML$deserialize_path()}}
}
\description{
Configuration
}
\examples{
vcr_configure(dir = tempdir())
vcr_configure(dir = tempdir(), record = "all")
vcr_configuration()
vcr_config_defaults()
vcr_configure(tempdir(), ignore_localhost = TRUE)

# logging
vcr_configure(tempdir(), log = TRUE, 
  log_opts = list(file = file.path(tempdir(), "vcr.log")))
vcr_configure(tempdir(), log = TRUE, log_opts = list(file = "console"))
vcr_configure(tempdir(), log = TRUE,
 log_opts = list(
   file = file.path(tempdir(), "vcr.log"), 
   log_prefix = "foobar"
))
vcr_configure(tempdir(), log = FALSE)

# filter sensitive data
vcr_configure(tempdir(), 
  filter_sensitive_data = list(foo = "<bar>")
)
vcr_configure(tempdir(), 
  filter_sensitive_data = list(foo = "<bar>", hello = "<world>")
)
}