within_body_text()) that can be specified in
capture_requests()so that sensitive information like tokens and ids can be purged from recorded response files. The default redacting function is
redact_auth(), which wraps several of them. See
vignette("redacting", package="httptest")for more.
skip_if_disconnected()now also wraps
testthat::skip_on_cran()so that tests that require a real network connection don’t cause a flaky test failure on CRAN
without_internet()handle multipart and urlencoded form data in mocked HTTP requests.
buildMockURL()escapes URL characters that are not valid in file names on all R platforms (which
R CMD checkwould warn about).
capture_requests()now has a
verboseargument, which, if
TRUE, prints a message with the file path where each captured request is written.
capture_requests()takes the first element in
.mockPaths()as its default “path” argument. The default is unchanged since
.mockPaths()by default returns the current working directory, just as the “path” default was, but if you set a different mock path for reading mocks,
capture_requests()will write there as well.
capture_requests()now writes non-JSON-content-type and non-200-status responses as full “response” objects in .R files.
with_mock_API()now looks for .R mocks if a .json mock isn’t found. This allows all requests and all responses, not just JSON content, to be mocked.
.mockPaths()function, in the model of
.libPaths(), which allows you to specify alternate directories in which to search for mock API responses.