knitr::opts_chunk$set(
  comment = "#>",
  tidy = FALSE,
  error = FALSE,
  fig.width = 8,
  fig.height = 8)

httrmock

Mock HTTP Requests for API Testing

Linux Build Status Windows Build status CRAN RStudio mirror downloads

Mock HTTP Requests for API Testing

Installation

Once on CRAN, install the package as usual:

install.packages("r-lib/httrmock")

Introduction

TODO

httrmock was inspired by https://github.com/assaf/node-replay

Usage in packages:

TODO

The database:

httrmock uses the storr package to store the requests and responses in RDS files, see storr::storr(). By default the database is in the tests/testthat directory, which is appropriate for testthat tests. For an alternative directory, set the HTTRMOCK_STORE environment variable and point it to the directory you wish to use. The directory will be created if it does not exist.

Debugging:

httrmock uses debugme for easy debugging of what is recorded and replayed, see debugme::debugme() for details.

License

MIT © Gábor Csárdi, RStudio



r-lib/httrmock documentation built on May 14, 2019, 2:33 p.m.