ropensci / vcr

Record and replay HTTP requests
https://docs.ropensci.org/vcr
Other
77 stars 12 forks source link

Writing to disk does not yet work with httr2 #270

Open sckott opened 2 months ago

sckott commented 2 months ago
library(vcr)
library(httr2)

tmpdir <- tempdir()
invisible(vcr_configure(
  dir = file.path(tmpdir, "fixtures"),
  write_disk_path = file.path(tmpdir, "files")
))

my_file <- tempfile(tmpdir = file.path(tmpdir, "files"))

use_cassette(name = "stuff2", {
  request("https://google.com") |> req_perform(path = my_file)
})

readLines(my_file)
#> Warning in file(con, "r"): cannot open file
#> '/var/folders/qt/fzq1m_bj2yb_7b2jz57s9q7c0000gp/T//Rtmp8tCUFj/files/file6ec3313ed849':
#> No such file or directory
#> Error in file(con, "r"): cannot open the connection

Created on 2024-09-04 with reprex v2.1.1