Learn R Programming

webmockr (version 2.2.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

2,697

Version

2.2.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Scott Chamberlain

Last Published

July 21st, 2025

Functions in webmockr (2.2.0)

RequestSignature

RequestSignature
RequestPattern

RequestPattern class
MethodPattern

MethodPattern
BodyPattern

BodyPattern
CrulAdapter

Adapters for Modifying HTTP Requests
HashCounter

HashCounter
RequestRegistry

RequestRegistry
build_httr_response

Build a httr response
last_stub

Get the last stub created
enable

Enable or disable webmockr
build_crul_request

Build a crul request
build_httr2_response

Build a httr2 response (httr2_response)
build_httr2_request

Build an httr2 request
HttpLibAdapaterRegistry

HttpLibAdapaterRegistry
Response

Response
HeadersPattern

HeadersPattern
handle_stub_removal

Handle stub removal
build_httr_request

Build a httr request
UriPattern

UriPattern
StubbedRequest

StubbedRequest
build_crul_response

Build a crul response
httr_mock

Turn on httr mocking
remove_request_stub

Remove a request stub
httr2_mock

Turn on httr2 mocking
mock_file

Mock file
wi_th

Set additional parts of a stubbed request
stub_request

Stub an http request
wi_th_

This function is defunct.
pluck_body

Extract the body from an HTTP request
to_raise

Set raise error condition
webmockr_disable

This function is defunct.
StubRegistry

StubRegistry
StubCounter

StubCounter
including

Partially match request query parameters or request bodies
mocking-disk-writing

Mocking writing to disk
to_return

Expectation for what's returned from a stubbed request
request_registry

List or clear requests in the request registry
%>%

Pipe operator
last_request

Get the last HTTP request made
stub_body_diff

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

execute a curl request
webmockr_reset

webmockr_reset
webmockr_enable

This function is defunct.
webmockr_configure

webmockr configuration
to_return_

This function is defunct.
webmockr-package

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

List stubs in the stub registry
stub_registry_clear

stub_registry_clear
to_timeout

Set timeout as an expected return on a match
webmockr-defunct

Defunct functions in webmockr