{"id":14067584,"url":"https://github.com/ropensci/vcr","last_synced_at":"2025-10-22T06:25:01.613Z","repository":{"id":24378964,"uuid":"27778540","full_name":"ropensci/vcr","owner":"ropensci","description":"Record and replay HTTP requests","archived":false,"fork":false,"pushed_at":"2025-07-25T17:24:30.000Z","size":2194,"stargazers_count":87,"open_issues_count":43,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-26T15:04:59.169Z","etag":null,"topics":["mocking","r","r-package","rstats","testing","unit-testing","vcr"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/vcr","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2014-12-09T17:38:38.000Z","updated_at":"2025-07-25T17:24:33.000Z","dependencies_parsed_at":"2024-02-04T07:27:56.595Z","dependency_job_id":"ac8077a0-affe-4c00-9551-885ba2f49597","html_url":"https://github.com/ropensci/vcr","commit_stats":{"total_commits":685,"total_committers":16,"mean_commits":42.8125,"dds":"0.20583941605839418","last_synced_commit":"ef700e5ce908e69b5f8352b98eaf12e4c8ce0748"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/ropensci/vcr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fvcr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fvcr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fvcr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fvcr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/vcr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fvcr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267798625,"owners_count":24145727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mocking","r","r-package","rstats","testing","unit-testing","vcr"],"created_at":"2024-08-13T07:05:40.510Z","updated_at":"2025-10-22T06:24:56.575Z","avatar_url":"https://github.com/ropensci.png","language":"R","funding_links":[],"categories":["R","Web/database applications"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r echo=FALSE}\nknitr::opts_chunk$set(\n  comment = \"#\u003e\",\n  collapse = TRUE,\n  warning = FALSE,\n  message = FALSE\n)\n```\n\n# vcr \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"120\" alt=\"\" /\u003e\n\n[![cran checks](https://badges.cranchecks.info/worst/vcr.svg)](https://CRAN.R-project.org/package=vcr)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![R-check](https://github.com/ropensci/vcr/workflows/R-check/badge.svg)](https://github.com/ropensci/vcr/actions/)\n[![codecov](https://codecov.io/gh/ropensci/vcr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/vcr)\n[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/vcr)](https://github.com/r-hub/cranlogs.app)\n[![cran version](https://www.r-pkg.org/badges/version/vcr)](https://cran.r-project.org/package=vcr)\n\n\n{vcr} records and replays HTTP requests so you can test your API package with speed and confidence. It makes your tests independent of your internet connection (so they work on CRAN!) and because your tests get much much faster, you can write even more, increasing the coverage of your package. {vcr} works with {crul}, {httr} and {httr2}.\n\n{vcr} draws inspiration from Ruby's [vcr](https://github.com/vcr/vcr).\n\n## Installation\n\n```{r}\n#| eval: false\n# Install the latest released version from CRAN\ninstall.packages(\"vcr\")\n\n# Or install the development version\n# from R-universe\ninstall.packages(\n  \"vcr\",\n  repos = c(\"https://ropensci.r-universe.dev\", \"https://cloud.r-project.org\")\n)\n\n# Or from GitHub:\n# install.packages(\"pak\")\npak::pak(\"ropensci/vcr\")\n```\n\n## Usage\n\nUsing vcr in a test is straightforward: just call `vcr::local_cassette()`. The first time your test is run, vcr will automatically record every HTTP request, saving the request and reponse in `tests/testthat/_vcr`. After that, it will replay those recorded requests, meaning that your test no longer needs an active connection.\n\n```{r}\n#| eval: false\ntest_that(\"can retrieve current version\", {\n  vcr::local_cassette(\"rl_version\")\n  expect_equal(rredlist::rl_version(), \"2025-1\")\n})\n```\n\nThe first argument to `local_cassette()` is the cassette name: it's used to name the cassette file so needs to be unique across tests. In this case, running the above test will generate `tests/testthat/_vcr/rl_version.yaml` which looks something like this:\n\n```yaml\nhttp_interactions:\n- request:\n    method: GET\n    uri: https://api.iucnredlist.org/api/v4/information/red_list_version\n  response:\n    status: 200\n    headers:\n      status: 'HTTP/2 200 '\n      cache-control: max-age=0, private, must-revalidate\n      content-type: application/json\n      etag: W/\"1694e95e54c5590a355e5922b47c7cd9\"\n      date: Tue, 06 May 2025 20:52:22 GMT\n    body:\n      string: '{\"red_list_version\":\"2025-1\"}'\n  recorded_at: 2025-05-06 20:52:21\nrecorded_with: VCR-vcr/2.0.0\n```\n\nIf you look carefully at this file, you'll notice an `Authorization` header is not recorded in the request headers despite it being used in the actual HTTP request. Read more about protecting secrets in the vignette `vignette(\"secrets\")`.\n\n## Learn more\n\nStart with `vignette(\"vcr\")` to learn more about how {vcr} works, especially how requests are matched to the recordeded cassette. You might also enjoy the [HTTP testing](https://books.ropensci.org/http-testing/) book for a lot more details about {vcr}, {webmockr}, {curl} and more.\n\n## Meta\n\n* Please [report any issues or bugs](https://github.com/ropensci/vcr/issues)\n* License: MIT\n* Get citation information for `vcr` in R doing `citation(package = 'vcr')`\n* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fvcr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Fvcr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fvcr/lists"}