Skip to content

Commit bd28a1b

Browse files
authored
Fix for upcoming httr2 1.2.0 (#109)
httr2 now puts redacted headers inside a weakref which means that they can't accidentally be serialized to disk. It also exposes a new `req_get_headers()` accessor in order to get to the actual value if needed.
1 parent 8417324 commit bd28a1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/testthat/test-request-helpers.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ test_that("request helpers - building requests", {
2727
expect_identical(req$body$data, body)
2828
expect_no_error(req$options$useragent)
2929
expect_equal(req$policies$retry_max_tries, 3)
30-
expect_equal(req$headers$Authorization, paste("Bearer", token))
31-
30+
if (packageVersion("httr2") >= "1.1.2.9000") {
31+
headers <- httr2::req_get_headers(req, "reveal")
32+
} else {
33+
headers <- req$headers
34+
}
35+
expect_equal(headers$Authorization, paste("Bearer", token))
3236

3337
req_json <- db_request_json(req)
3438
expect_equal(unclass(req_json), "{\"a\":1,\"b\":2}")

0 commit comments

Comments
 (0)