A Test Environment for HTTP Requests


[Up] [Top]

Documentation for package ‘httptest’ version 4.2.2

Help Pages

httptest-package 'httptest': A Test Environment for HTTP Requests
.mockPaths Set an alternate directory for mock API fixtures
block_requests Block HTTP requests
build_mock_url Convert a request to a mock file path
capture_requests Record API responses as mock files
change_state Handle a change of server state
end_vignette Set mocking/capturing state for a vignette
expect_DELETE Expectations for mocked HTTP requests
expect_GET Expectations for mocked HTTP requests
expect_header Test that an HTTP request is made with a header
expect_json_equivalent Test that objects would generate equivalent JSON
expect_no_request Expectations for mocked HTTP requests
expect_PATCH Expectations for mocked HTTP requests
expect_POST Expectations for mocked HTTP requests
expect_PUT Expectations for mocked HTTP requests
expect_verb Expectations for mocked HTTP requests
fake_response Return something that looks like a 'response'
gsub_request Find and replace within a 'response' or 'request'
gsub_response Find and replace within a 'response' or 'request'
httptest 'httptest': A Test Environment for HTTP Requests
public Test that functions are exported
redact Remove sensitive content from HTTP responses
redact_auth Remove sensitive content from HTTP responses
redact_cookies Remove sensitive content from HTTP responses
redact_headers Remove sensitive content from HTTP responses
set_redactor Set a response redactor
set_requester Set a request preprocessor
skip_if_disconnected Skip tests that need an internet connection if you don't have one
start_capturing Record API responses as mock files
start_vignette Set mocking/capturing state for a vignette
stop_capturing Record API responses as mock files
stop_mocking Turn off request mocking
use_httptest Use 'httptest' in your tests
use_mock_api Turn on API mocking
within_body_text Remove sensitive content from HTTP responses
without_internet Make all HTTP requests raise an error
with_fake_http Make all HTTP requests return a fake response
with_mock_api Serve a mock API from files
with_mock_dir Use or create mock files depending on their existence