use_mock_api: Turn on API mocking

View source: R/mock-api.R

use_mock_apiR Documentation

Turn on API mocking

Description

This function intercepts HTTP requests made through httr and serves mock file responses instead. It is what with_mock_api() does, minus the automatic disabling of mocking when the context finishes.

Usage

use_mock_api()

Details

Note that you in order to resume normal request behavior, you will need to call stop_mocking() yourself—this function does not clean up after itself as 'with_mock_api' does.

Value

Nothing; called for its side effects.

See Also

with_mock_api() stop_mocking() block_requests()


httptest documentation built on July 9, 2023, 7:45 p.m.