Learn R Programming

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

5,477

Version

2.0.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Scott Chamberlain

Last Published

February 11th, 2025

Functions in webmockr (2.0.0)

HttpLibAdapaterRegistry

HttpLibAdapaterRegistry
Response

Response
BodyPattern

BodyPattern
HashCounter

HashCounter
CrulAdapter

Adapters for Modifying HTTP Requests
RequestSignature

RequestSignature
RequestPattern

RequestPattern class
HeadersPattern

HeadersPattern
MethodPattern

MethodPattern
StubbedRequest

StubbedRequest
StubCounter

StubCounter
build_httr2_request

Build an httr2 request
StubRegistry

StubRegistry
build_httr_request

Build a httr request
build_httr_response

Build a httr response
build_crul_response

Build a crul response
build_httr2_response

Build a httr2 response (httr2_response)
UriPattern

UriPattern
build_crul_request

Build a crul request
last_stub

Get the last stub created
enable

Enable or disable webmockr
mocking-disk-writing

Mocking writing to disk
httr2_mock

Turn on httr2 mocking
httr_mock

Turn on httr mocking
request_registry

List or clear requests in the request registry
stub_body_diff

Get a diff of a stub request body and a request body from an http request
%>%

Pipe operator
mock_file

Mock file
pluck_body

Extract the body from an HTTP request
remove_request_stub

Remove a request stub
wi_th

Set additional parts of a stubbed request
handle_stub_removal

Handle stub removal
stub_request

Stub an http request
to_raise

Set raise error condition
last_request

Get the last HTTP request made
to_return

Expectation for what's returned from a stubbed request
including

Partially match request query parameters or request bodies
to_return_

This function is defunct.
wi_th_

This function is defunct.
to_timeout

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

Defunct functions in webmockr
stub_registry_clear

stub_registry_clear
stub_registry

List stubs in the stub registry
webmockr_configure

webmockr configuration
webmockr_disable

This function is defunct.
webmockr_crul_fetch

execute a curl request
webmockr-package

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

This function is defunct.
webmockr_reset

webmockr_reset
RequestRegistry

RequestRegistry