Package: httptest 4.2.2.9000

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.2.9000.tar.gz
httptest_4.2.2.9000.zip(r-4.5)httptest_4.2.2.9000.zip(r-4.4)httptest_4.2.2.9000.zip(r-4.3)
httptest_4.2.2.9000.tgz(r-4.5-any)httptest_4.2.2.9000.tgz(r-4.4-any)httptest_4.2.2.9000.tgz(r-4.3-any)
httptest_4.2.2.9000.tar.gz(r-4.5-noble)httptest_4.2.2.9000.tar.gz(r-4.4-noble)
httptest_4.2.2.9000.tgz(r-4.4-emscripten)httptest_4.2.2.9000.tgz(r-4.3-emscripten)
httptest.pdf |httptest.html
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 site:https://enpiar.com

On CRAN:

Conda:

httpmocktest-framework

9.46 score 81 stars 1 packages 276 scripts 2.2k downloads 40 exports 30 dependencies

Last updated 1 years agofrom:5b8b14bf10. Checks:9 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKMar 24 2025
R-4.5-winOKMar 24 2025
R-4.5-macOKMar 24 2025
R-4.5-linuxOKMar 24 2025
R-4.4-winOKMar 24 2025
R-4.4-macOKMar 24 2025
R-4.4-linuxOKMar 24 2025
R-4.3-winOKMar 24 2025
R-4.3-macOKMar 24 2025

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 Mar 24 2025.

Last update: 2020-12-15
Started: 2020-12-15

httptest: A Test Environment for HTTP Requests in R

Rendered fromhttptest.Rmdusingknitr::rmarkdownon Mar 24 2025.

Last update: 2021-01-31
Started: 2017-06-01

Redacting and Modifying Recorded Requests

Rendered fromredacting.Rmdusingknitr::rmarkdownon Mar 24 2025.

Last update: 2021-01-31
Started: 2017-10-08

Writing Vignettes with APIs

Rendered fromvignettes.Rmdusingknitr::rmarkdownon Mar 24 2025.

Last update: 2021-01-31
Started: 2018-01-12