Skip to content

Commit

Permalink
Remove request from saved responses
Browse files Browse the repository at this point in the history
  • Loading branch information
nealrichardson committed Apr 25, 2024
1 parent cff21ee commit 1866f7a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions R/capture-requests.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ save_response <- function(response, file, simplify = TRUE) {
}
# Needed for httr2 1.0.0
response$cache <- quote(new.env(parent = emptyenv()))
response$request <- NULL

f <- file(dst_file, "wb", encoding = "UTF-8")
on.exit(close(f))
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-capture-requests.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ test_that("We can record a series of requests (a few ways)", {
teapot <- source(file.path(d, httpbin_mock_url, "status", "418.R"))$value
expect_s3_class(teapot, "httr2_response")
expect_identical(resp_status(teapot), 418L)
expect_false("request" %in% names(teapot))
# Make sure that our .html file has HTML
expect_true(any(grepl(
"</body>",
Expand Down

0 comments on commit 1866f7a

Please sign in to comment.