Skip to content

Commit

Permalink
change httr2::local_mock to httr2::local_mocked_responses
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Nov 18, 2023
1 parent 4acbc86 commit 72bc7a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/adapter-httr2.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ build_httr2_request = function(x) {
httr2_mock <- function(on = TRUE) {
check_for_pkg("httr2")
if (on) {
httr2::local_mock(~ Httr2Adapter$new()$handle_request(.x), env = .GlobalEnv)
httr2::local_mocked_responses(~ Httr2Adapter$new()$handle_request(.x), env = .GlobalEnv)
} else {
httr2::local_mock(NULL, env = .GlobalEnv)
httr2::local_mocked_responses(NULL, env = .GlobalEnv)
options(httr2_mock = NULL)
}
invisible(on)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-Httr2Adapter.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ test_that("httr2 works with webmockr_allow_net_connect", {
# allow net connect - stub now gone - so real request should happen
stub_registry_clear()
req <- request("https://hb.opencpu.org/get?stuff=things")
httr2::local_mock(NULL)
httr2::local_mocked_responses(NULL)
w <- req_perform(req)
expect_false(resp_body_string(w) == "yum=cheese")
})
Expand Down

0 comments on commit 72bc7a2

Please sign in to comment.