httptest: A Test Environment for HTTP Requests

Testing code and packages that communicate with remote servers can be painful. Dealing with authentication, bootstrapping server state, cleaning up objects that may get created during the test run, network flakiness, 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 test contexts that mock the network connection in different ways, and it offers additional expectations to assert that HTTP requests were–or were not–made. Using these tools, one can test that code is making the intended requests and that it handles the expected responses correctly, all without depending on a connection to a remote API.

Version: 1.1.0
Depends: R (≥ 3.0.0), testthat
Imports: digest, httr, jsonlite
Published: 2017-02-03
Author: Neal Richardson [aut, cre]
Maintainer: Neal Richardson <neal.p.richardson at>
License: MIT + file LICENSE
NeedsCompilation: no
Materials: README NEWS
CRAN checks: httptest results


Reference manual: httptest.pdf
Package source: httptest_1.1.0.tar.gz
Windows binaries: r-devel:, r-release:, r-oldrel:
OS X Mavericks binaries: r-release: httptest_1.1.0.tgz, r-oldrel: httptest_1.1.0.tgz
Old sources: httptest archive

Reverse dependencies:

Reverse suggests: crunch, httpcache


Please use the canonical form to link to this page.