Learn R Programming

webmockr (version 2.1.0)

Stubbing and Setting Expectations on 'HTTP' Requests

Description

Stubbing and setting expectations on 'HTTP' requests. Includes tools for stubbing 'HTTP' requests, including expected request conditions and response conditions. Match on 'HTTP' method, query parameters, request body, headers and more. Can be used for unit tests or outside of a testing context.

Copy Link

Version

Install

install.packages('webmockr')

Monthly Downloads

4,767

Version

2.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Scott Chamberlain

Last Published

June 29th, 2025

Functions in webmockr (2.1.0)

last_stub

Get the last stub created
StubbedRequest

StubbedRequest
last_request

Get the last HTTP request made
mock_file

Mock file
mocking-disk-writing

Mocking writing to disk
build_httr2_response

Build a httr2 response (httr2_response)
build_httr2_request

Build an httr2 request
to_return

Expectation for what's returned from a stubbed request
UriPattern

UriPattern
build_crul_response

Build a crul response
build_crul_request

Build a crul request
stub_request

Stub an http request
enable

Enable or disable webmockr
%>%

Pipe operator
handle_stub_removal

Handle stub removal
request_registry

List or clear requests in the request registry
to_raise

Set raise error condition
webmockr-defunct

Defunct functions in webmockr
to_timeout

Set timeout as an expected return on a match
StubCounter

StubCounter
httr2_mock

Turn on httr2 mocking
StubRegistry

StubRegistry
webmockr_enable

This function is defunct.
webmockr_reset

webmockr_reset
stub_registry_clear

stub_registry_clear
stub_registry

List stubs in the stub registry
webmockr_disable

This function is defunct.
webmockr_crul_fetch

execute a curl request
stub_body_diff

Get a diff of a stub request body and a request body from an http request
to_return_

This function is defunct.
webmockr-package

webmockr: Stubbing and Setting Expectations on 'HTTP' Requests
httr_mock

Turn on httr mocking
pluck_body

Extract the body from an HTTP request
webmockr_configure

webmockr configuration
remove_request_stub

Remove a request stub
wi_th

Set additional parts of a stubbed request
wi_th_

This function is defunct.
HashCounter

HashCounter
RequestPattern

RequestPattern class
RequestRegistry

RequestRegistry
HeadersPattern

HeadersPattern
BodyPattern

BodyPattern
CrulAdapter

Adapters for Modifying HTTP Requests
MethodPattern

MethodPattern
HttpLibAdapaterRegistry

HttpLibAdapaterRegistry
including

Partially match request query parameters or request bodies
RequestSignature

RequestSignature
build_httr_response

Build a httr response
build_httr_request

Build a httr request
Response

Response