The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
vcr
now supports httr2
in addition to
httr
and crul
. (#237) (#268)vcr
now supports async http requests with
crul
(w/ crul
v1.5 or greater). no change was
required in vcr
for this to happen. a PR was merged in
crul
to hook into vcr
. there’s no support for
async in httr
as that package does not do any async and no
support in httr2
because req_perform_parallel
does not have a mocking hook as does req_perform
(#246)_PACKAGE
syntax for package level doc (#263)use_vcr()
now creates a test helper file called
helper-vcr.R
instead of setup-pkgname.R
. We
are reverting the change from version 0.6.0 and now recommend the use of
helper-*.R
again, so that the vcr setup is
loaded with devtools::load_all()
. That way your
vcr-enabled tests also work when run interactively (#244) (#256)body_from
) (#249) (#252)preserve_exact_body_bytes = TRUE
now writes a
base64 encoded string into a field in yaml or json on disk called
base64_string
. When
preserve_exact_body_bytes = FALSE
(the default) the
response body goes into a field called string
vcr_test_path
fix to find root package path correctly
with R 4.2 on Windows (#242) (#243) thanks to @dpprdanvcr_test_path()
to find root package path
correctly (#235) (#236)check_cassette_names()
gains
allowed_duplicates
parameter to allow duplicate cassette
names; we typically advise users not to use duplicate cassette names,
but there are cases where you may want to share cassettes across tests
(#227)vcr_configure()
gains
filter_query_parameters
parameter for filtering out query
parameters so they don’t show up in the recorded request on disk
(#212)use_vcr()
: now sets a mimimum vcr version, which is
usually the latest (stable) version on CRAN. You can of course easily
remove or change the version requirement yourself after running it
(#214)vcr_configure()
gains
warn_on_empty_cassette
parameter: Should a warning be
thrown when an empty cassette is detected? Empty cassettes are cleaned
up (deleted) either way (#224) thanks @llrs and @dpprdanvcr_configure()
gains quiet
parameter:
suppress any messages from both vcr and webmockr (#226) (#25)vcr_configure()
gains new option
filter_sensitive_data_regex
; now
filter_sensitive_data
is for fixed string matching, while
filter_sensitive_data_regex
is for regex based matching
(#222) thanks @tomsing1 for reportingrprojroot
filter_sensitive_data
option now strips leading and
trailing single and double quotes from strings before being used IN CASE
a user accidentally quotes a secret - logic being that even though a
secret may have a single or double quote in it, its very unlikely that
it would have both a leading and trailing quote (single or double)
(#221)filter_request_headers
example (#215) thanks @maellefilter_request_headers
was unfortunately adding a
request header to the request written to disk when the header did not
exist; now fixed (#213)is_base64()
;
strsplit()
needed useBytes=TRUE
(#219)filter_sensitive_data
was not working when strings
contained regex characters; fixed, and see also above new config
variable for regex specific filtering (#222) thanks @tomsing1 for
reportingvcr_test_path()
should now correctly set paths (#225)
(#228) (#229) (#230)vcr_configure(serialize_with="json")
or per
cassette use_cassette(..., serialize_with="json")
. The JSON
serializer uses jsonlite
under the hood. Note that we by
default do not write JSON to disk preserving newlines; that is the JSON
is all on one line. You can use pretty printing by setting
json_pretty
in vcr_configure()
. As part of
this change, factored out new R6 class Serializer
from
which both JSON and YAML serializers inherit (#32)filter_request_headers
and
filter_response_headers
. These are implemented differently
than filter_sensitive_data
. The two new filters do simple
value replacement or complete removal of request or response headers,
whereas filter_sensitive_data
uses regex to replace strings
anywhere in the stored request/response. See the “Configure vcr”
vignette for details (#182)host
and path
now work
(#177) (see also #70)insert_cassette()
/eject_cassette()
workflow
did not work because the webmockr triggers required only worked when
using use_cassette()
. This has been fixed now so you can
use use_cassette()
, passing a code block to it, or run
insert_cassette()
then run any code, then when finished run
eject_cassette()
. (#24) thanks @Robsteranium for the nudge, may not
have fixed this without itvcr_test_path()
-
which is now used in use_vcr()
so that the correct path to
tests is used when running tests both interactively and
non-interactively (#192) (#193)lazyeval
from Imports;
withr
added to Suggests; minimum webmockr
version now v0.7.4
skip_if_vcr_off()
to use in tests to
skip a test if vcr is turned off (#191) (#195)$deserialize_string()
method as was
not used - rename $deserialize_path()
method to just
$deserialize()
(#189)?vcr_configure
and ?use_cassette
stating that
you can have different cassettes with the same name as long as they use
different serializers (and then have different file extensions). if you
want to change serializers but do not want to keep the old cassette with
the old serializer make sure to clean up the old file (#188)UnhandledHTTPRequestError
- remove unused
variable cassette
in $initialize()
method
(always use current_cassette()
to get the cassette being
used) (#163) tip from @aaronwolenv0.7.4
) allowed
for changes here to return an httr response
object that
more closely matches what httr returns in a real HTTP request. Before
this the major problem was, assuming x
is a httr
response
object, x$request
was a
RequestSignature
object (from webmockr
),
whereas the class in a real httr response object is request
(#132)Cassette
class greatly simplifying
webmockr HTTP request stubbing (#98) (#173) big thanks to @alex-gable !HTTPInteractionList
improvement: in checking for
request matches against those on disk we were checking all requesets in
a cassette - faster to check and stop when a match found. Using new
factored out function to do this checking that stops when first match
found. Many more tests added to check this behavior (#69)preserve_exact_body_bytes=TRUE
) - this makes cassettes
longer however. Implementing this brought in use of cpp11
(first use of C++ in vcr). This makes base64 encoded response body
recording consistent with how vcr’s in other programming languages do it
(#41)decode_compressed_response
option removed from
Cassette
class - wasn’t being used and won’t be used
(#30)VcrResponse
docs showing
what the update_content_length_header()
does (#29)use_vcr()
changes: 1) now creates a test helper file
called setup-pkgname.R
instead of
helper-pkgname.R
; 2) now by default sets directory for
fixtures using dir = vcr_test_path("fixtures")
instead of
dir = "../fixtures"
. See other news item about
vcr_test_path
webmockr
is
integrated in Cassette
class - see section “Points of
webmockr integration” in ?Cassette
(#176) (see also
#173)verbose_errors
setting in the
vcr_configure()
function. In addition,
vcr_last_error()
gives the last full error, but that
doesn’t help in non-interactive mode; if in non-interactive mode, which
most users will be in when running the entire test suite for a package,
you can set an environment variable (VCR_VERBOSE_ERRORS
) to
toggle this setting (e.g.,
Sys.setenv(VCR_VERBOSE_ERRORS=TRUE); devtools::test()
)
(#121) (#154)write_disk_path
handling internally to not run
it through normalizePath
before recording it to the
cassette; passing the path through normalizePath
was
leading to the full path recorded in the cassette, which means in a
package testing context that a test that uses a file on disk will
(likely) only work on the machine the cassette was first created on.
with relative paths in a package context, a test that has a file written
on disk should now work in different testing contexts (locally, and
various continuous integration platforms) (#135) (#166).Rinstignore
and/or .Rbuildignore
(#164)check_cassette_names
to use in your
helper-pkgname.R
file in your test suite; it checks for
duplicated cassette names only. Any use of
insert_cassette()
(thereby, any use of
use_cassette()
) uses a revamped version of an internal fxn
that checks for an improved list of potential problems in cassette names
(#116) (#159)use_vcr()
adds gitignore cassette diffs via the
addition of a gitattributes
file (#109)vcr_configure()
overhaul: function no longer has each
setting as a parameter; rather, it has an ellipsis (...
),
and internally we check parameters passed in. The documentation
(?vcr_configure
) lists the details for each available
parameter. Importantly, each call to vcr_configure()
now
only changes the vcr settings for parameters passed in to the function;
to reset all vcr settings, run vcr_configure_reset()
(#136)
(#141)insert_cassette()
and use_cassette()
now
inherit any vcr settings set by vcr_configure()
; this
wasn’t happening consistently before. Most default parameter values in
insert_cassette/use_cassette
set to NULL
, in
which case they inherit from whatever values are set by
vcr_configure()
, but can be overriden (#151) (#153)filter_sensitive_data
parameter description in
vcr_configure
docs (#129)utils::getParseData
so its in namespace
(#142)use_vcr()
no longer uses context()
in
example test file (#144)use_cassette
test (#133)vcr_configure()
when parameters are
set by the user to fail early (#156)preserve_exact_body_bytes
when image data is in the
response body (#128) thanks @Rekytsensitive_remove()
internal function used when
the user sets filter_sensitive_data
in
vcr_configure()
; when an env var is missing in the
filter_sensitive_data
list, sensitive_remove()
was causing C stack errors in some cases (#160) thanks @zachary-fosterencode="json"
with crul or httr) (#130)crul
and
httr
that write to disk; crul
supports this
with the disk
parameter and httr
through the
write_disk()
function; see the section on mocking writing
to disk in the http testing book
https://books.ropensci.org/http-testing/vcr-usage.html#vcr-disk; also
see ?mocking-disk-writing
within webmockr
for
mocking writing to disk without using vcr
, and the section
in the http testing book
https://books.ropensci.org/http-testing/webmockr-stubs.html#webmockr-disk
(#81) (#125)vcr::use_cassette
/vcr::insert_cassette
; this
is helpful if you want to run tests both with and without vcr; workflows
are supported both for setting env vars on the command line as well as
working interactively within R; see ?lightswitch
for
details (#37)crul
(not httr
), and works for
ignoring specifc hosts, and localhosts, but not for custom callbacks.
See the vcr configuration vignette
https://docs.ropensci.org/vcr/articles/configuration.html#ignoring-some-requests
for discussion and examples (#127)httr
wasn’t working
(htrr::authenticate()
); we were not capturing use of
authenticate
; it’s been solved now (#113)httr
requests; that’s been fixed (#122)response_summary()
fixed; this function prints a
summary of the http response body; sometimes this function would fail
with multibyte string error because the gsub
call would
change the encoding, then would fail on the substring
call;
we now set useBytes = TRUE
in the gsub
call to
avoid this problem (#126)up_to_date_interactions
in
cassette_class
now allows filtering cassettes by user
specified date (#96) (#104)use_casette()
parameters re_record_interval
and
clean_outdated_http_interactions
; you can now set a
re-record interval (in seconds) so that you can for example always
re-record cassettes if you don’t want cassettes to be more than X days
old; depends on new internal method up_to_date_interactions
(#104) (#105)webmockr
package (requires v0.4 or greater); more
generally, makes single type request matching (e.g., just HTTP method,
or just URL) possible, it was not working before, but is now working;
added examples of doing single type matching (#70) (#76) (#108)cassette_class
where typo lead to not
setting headers correctly in the webmockr::wi_th()
call
(#107)use_vcr()
to setup vcr
for
your package. This requires 3 pkgs all in Suggests; so are not required
if you don’t need to use use_vcr()
(#52) (#95) thanks @maelle for the
feedback!vcr
actually supports all four recording modes:
none
, once
, new_episodes
, and
all
. once
is what’s used by default. See
?recording
for description of the recording modes. For now
the
test file test-ause_cassette_record_modes.R gives some examples and
what to expect for each record mode; in the future the http testing book
will have much more information in the Record modes chapter https://books.ropensci.org/http-testing/record-modes.html
(commit)as.list()
:
all
to all.names
httr
due to wrong date format. the
problem was in the webmockr
package. see ropensci/webmockr#58
(#91) thanks @Bisaloouse_cassette()
when using httr
: we
weren’t collecting status_code
and storing it with the
cassette (#92) thanks @Bisaloouse_cassette()
for httr
: was
working fine with a single httr request, but not with 2 or more (#93)
(#94) thanks @Rekytuse_cassette()
the URL is
presented from the request, and if there’s a secret (API key) in the URL
as a query parameter (or in any other place in the URL) then that secret
is shown to the world (including if the error block happens on CI on the
public web). This is fixed now; we use directives from your
filter_sensitive_data
call in vcr_configure()
to mask secrets in error messages (#89) (#90)vcr
with devtools::check
vs. devtools::test
(#83)vcr
in test suites from
use_cassette
block wrapped in test_that
to the
other way around; leads to testthat
pointing to the actual
test line that failed rather than pointing to the start of the
use_cassette
block (#86)%||%
internal function. Was incorrectly doing
logical comparison; when headers list was passed one or more of the
tests in the if statement had length > 1. Dev R is testing for this
(#87)httr
package. vcr
now supports crul
and httr
. Some of the
integration for httr
is via webmockr
, while
some of the tooling resides here in vcr
(#73) (#79)These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.