httptest: A Test Environment for HTTP Requests

Testing and documenting code that communicates with remote servers can be painful. Dealing with authentication, server state, and other complications can make testing seem too costly to bother with. But it doesn't need to be that hard. This package enables one to test all of the logic on the R sides of the API in your package without requiring access to the remote service. Importantly, it provides three contexts that mock the network connection in different ways, as well as testing functions to assert that HTTP requests were—or were not—made. It also allows one to safely record real API responses to use as test fixture. The ability to save responses and load them offline also enables one to write vignettes and other dynamic documents that can be distributed without access to a live server.

Version: 3.0.0
Depends: R (≥ 3.0.0), testthat
Imports: digest, httr, jsonlite, stats
Suggests: covr, knitr, rmarkdown, spelling, xml2
Published: 2018-01-16
Author: Neal Richardson [aut, cre]
Maintainer: Neal Richardson <neal.p.richardson at>
License: MIT + file LICENSE
NeedsCompilation: no
Language: en-US
Materials: README NEWS
CRAN checks: httptest results


Reference manual: httptest.pdf
Vignettes: httptest: A Test Environment for HTTP Requests in R
Redacting and Modifying Recorded Requests
Writing Vignettes with APIs
Package source: httptest_3.0.0.tar.gz
Windows binaries: r-devel:, r-release:, r-oldrel:
OS X El Capitan binaries: r-release: httptest_3.0.0.tgz
OS X Mavericks binaries: r-oldrel: httptest_2.3.4.tgz
Old sources: httptest archive

Reverse dependencies:

Reverse suggests: AlphaVantageClient, crplyr, crunch, dkanr, edgarWebR, googleAnalyticsR, googleAuthR, googleLanguageR, httpcache, pivotaltrackR, qualtRics, rGoodData


Please use the canonical form to link to this page.