Create a wrapper around httptest2::with_mock_dir() and a replacement for httptest2:::mock_request() to add the request to the mocked response. Also add a ticket to beekeeper to use this wrapper in tests. Unfortunately, since mock_request() isn't exported, I'm not sure yet what's viable here. with_mock_dir() calls with_mock_api() which calls use_mock_api() (sets options(httr2_mock = mock_request)) and on.exit(stop_mocking()) (sets options(httr2_mock = NULL)). We can't change the option in-between when with_mock_api() sets it and when it calls eval.parent(expr), so I think we'll need to create our own variation on with_mock_api() (and with_moc_dir() to call ours), and then our own mock function. We could wrap httptest2's mock_request() if it were exported, but, unfortunately, it isn't. That's at least one avenue to pursue.
Create a wrapper around
httptest2::with_mock_dir()and a replacement forhttptest2:::mock_request()to add the request to the mocked response. Also add a ticket to beekeeper to use this wrapper in tests. Unfortunately, sincemock_request()isn't exported, I'm not sure yet what's viable here.with_mock_dir()callswith_mock_api()which callsuse_mock_api()(setsoptions(httr2_mock = mock_request)) andon.exit(stop_mocking())(setsoptions(httr2_mock = NULL)). We can't change the option in-between whenwith_mock_api()sets it and when it callseval.parent(expr), so I think we'll need to create our own variation onwith_mock_api()(andwith_moc_dir()to call ours), and then our own mock function. We could wraphttptest2'smock_request()if it were exported, but, unfortunately, it isn't. That's at least one avenue to pursue.