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
StubRegistry
StubRegistry
request_registry() request_registry_clear()
List or clear requests in the request registry
RequestRegistry
RequestRegistry
webmockr_reset()
webmockr_reset

Stubbing requests

StubbedRequest
StubbedRequest
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

HTTP package adapters and utilities

CrulAdapter HttrAdapter Httr2Adapter Adapter
Adapters for Modifying HTTP Requests
HttpLibAdapaterRegistry
HttpLibAdapaterRegistry
build_crul_request()
Build a crul request
build_crul_response()
Build a crul response
build_httr_request()
Build a httr request
build_httr_response()
Build a httr response
build_httr2_request()
Build an httr2 request
build_httr2_response()
Build a httr2 response (httr2_response)

Internal utilities

RequestPattern
RequestPattern class
RequestSignature
RequestSignature
HashCounter
HashCounter
StubCounter
StubCounter
pluck_body()
Extract the body from an HTTP request
Response
Response