tests/testthat/test-request_handler.R

test_that("helpful error if no requests match", {
  local_vcr_configure(dir = withr::local_tempdir(), record = "none")

  req <- httr2::request(hb("/get"))
  expect_snapshot(use_cassette("test", httr2::req_perform(req)), error = TRUE)

  # Make it clear that we don't get a redundant warning about the cassette
  # being empty
  use_cassette("test", httr2::req_perform(req)) |>
    expect_no_warning() |>
    expect_error(class = "vcr_unhandled")
})

Try the vcr package in your browser

Any scripts or data that you put into this service are public.

vcr documentation built on Aug. 8, 2025, 6:45 p.m.