library(httr2)
library(testthat, warn.conflicts = FALSE)
without_internet({
expect_error(
request("http://httpbin.org/get") %>% req_perform(),
"GET http://httpbin.org/get"
)
expect_error(
request("http://httpbin.org/put") %>%
req_method("PUT") %>%
req_body_json(list(a = 1)) %>%
req_perform(),
'PUT http://httpbin.org/put {"a":1}',
fixed = TRUE
)
})
Run the code above in your browser using DataLab