vcr looks for similarity in your HTTP requests to cached requests. You can set what is examined about the request with one or more of the following options:

By default, we use method (HTTP method, e.g., GET) and uri (test for exact match against URI, e.g., http://foo.com).

You can set your own options by tweaking the match_requests_on parameter:

unlink(file.path(cassette_path(), "one.yml"))
use_cassette(name = "one", {
    cli$post("post", body = list(a = 5))
  },
  match_requests_on = c('method', 'headers', 'body')
)

For more details refer to the request matching vignette.



ropensci/vcr documentation built on Feb. 5, 2024, 4:57 p.m.