webmockr-package | R Documentation |
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.
Stubbing HTTP requests at low http client lib level
Setting and verifying expectations on HTTP requests
Matching requests based on method, URI, headers and body
Supports multiple HTTP libraries, including crul, httr, and httr2
Integration with HTTP test caching library vcr
Supports async http request mocking with crul only
Maintainer: Scott Chamberlain myrmecocystus+r@gmail.com (ORCID)
Other contributors:
Aaron Wolen (ORCID) [contributor]
rOpenSci (019jywm96) [funder]
Useful links:
Report bugs at https://github.com/ropensci/webmockr/issues
library(webmockr)
stub_request("get", "https://httpbin.org/get")
stub_request("post", "https://httpbin.org/post")
stub_registry()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.