Package: httptest 4.2.3

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 fixtures. 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.

Authors:Neal Richardson [aut, cre], Jonathan Keane [ctb], Maëlle Salmon [ctb]

httptest_4.2.3.tar.gz
httptest_4.2.3.zip(r-4.7)httptest_4.2.3.zip(r-4.6)httptest_4.2.3.zip(r-4.5)
httptest_4.2.3.tgz(r-4.6-any)httptest_4.2.3.tgz(r-4.5-any)
httptest_4.2.3.tar.gz(r-4.7-any)httptest_4.2.3.tar.gz(r-4.6-any)
httptest_4.2.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
httptest/json (API)
NEWS

# Install 'httptest' in R:
install.packages('httptest', repos = c('https://nealrichardson.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/nealrichardson/httptest/issues

Pkgdown/docs site:https://enpiar.com

On CRAN:

Conda:

httpmocktest-framework

9.75 score 83 stars 337 scripts 4.5k downloads 40 exports 30 dependencies

Last updated from:97b186987c. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK135
source / vignettesOK162
linux-release-x86_64OK129
macos-release-arm64OK116
macos-oldrel-arm64OK107
windows-develOK85
windows-releaseOK89
windows-oldrelOK83
wasm-releaseOK110

Exports:.mockPathsblock_requestsbuild_mock_urlcapture_requestschange_stateend_vignetteexpect_DELETEexpect_GETexpect_headerexpect_json_equivalentexpect_no_requestexpect_PATCHexpect_POSTexpect_PUTfake_responsefind_mock_fileget_current_redactorget_current_requestergsub_requestgsub_responsepublicredact_authredact_cookiesredact_headerssave_responseset_redactorset_requesterskip_if_disconnectedstart_capturingstart_vignettestop_capturingstop_mockinguse_httptestuse_mock_apiwith_fake_httpwith_mock_apiwith_mock_dirwith_tracewithin_body_textwithout_internet

Dependencies:askpassbriocallrclicrayoncurldescdiffobjdigestevaluatefsgluehttrjsonlitelifecyclemagrittrmimeopensslpkgbuildpkgloadpraiseprocessxpsR6rlangrprojrootsystestthatwaldowithr

Frequently Asked Questions

Rendered fromfaq.Rmdusingknitr::rmarkdownon May 15 2026.

Last update: 2025-11-16
Started: 2020-12-15

httptest: A Test Environment for HTTP Requests in R

Rendered fromhttptest.Rmdusingknitr::rmarkdownon May 15 2026.

Last update: 2025-11-16
Started: 2017-06-01

Redacting and Modifying Recorded Requests

Rendered fromredacting.Rmdusingknitr::rmarkdownon May 15 2026.

Last update: 2025-11-16
Started: 2017-10-08

Writing Vignettes with APIs

Rendered fromvignettes.Rmdusingknitr::rmarkdownon May 15 2026.

Last update: 2025-11-16
Started: 2018-01-12