Skip to contents

webmockr

High level overview of package

webmockr webmockr-package
webmockr: Stubbing and Setting Expectations on 'HTTP' Requests
webmockr-defunct
Defunct functions in webmockr

Configuration

Enable/Disable webmockr

enable() enabled() disable()
Enable or disable webmockr
httr_mock()
Turn on httr mocking
httr2_mock()
Turn on httr2 mocking

Stub and Request registries

stub_registry()
List stubs in the stub registry
stub_registry_clear()
stub_registry_clear
request_registry() request_registry_clear()
List or clear requests in the request registry
webmockr_reset()
webmockr_reset

Stubbing requests

stub_request()
Stub an http request
remove_request_stub()
Remove a request stub
to_raise()
Set raise error condition
to_return()
Expectation for what's returned from a stubbed request
to_timeout()
Set timeout as an expected return on a match
wi_th()
Set additional parts of a stubbed request
including() excluding()
Partially match request query parameters or request bodies

Mocking writing to disk

mock_file()
Mock file
mocking-disk-writing
Mocking writing to disk

Introspection

last_request()
Get the last HTTP request made
last_stub()
Get the last stub created
stub_body_diff()
Get a diff of a stub request body and a request body from an http request

Deprecated

RequestPattern
RequestPattern class