# This function should perform a response against google.com:
google <- function() {
request("http://google.com") |>
req_perform()
}
# But I can use a mock to instead return my own made up response:
my_mock <- function(req) {
response(status_code = 403)
}
try(with_mock(my_mock, google()))
Run the code above in your browser using DataLab