Package: httptest2 1.1.0.9000
httptest2: Test Helpers for 'httr2'
Testing and documenting code that communicates with remote servers can be painful. This package helps with writing tests for packages that use 'httr2'. It enables testing all of the logic on the R sides of the API without requiring access to the remote service, and it also allows recording real API responses to use as test fixtures. The ability to save responses and load them offline also enables writing vignettes and other dynamic documents that can be distributed without access to a live server.
Authors:
httptest2_1.1.0.9000.tar.gz
httptest2_1.1.0.9000.zip(r-4.5)httptest2_1.1.0.9000.zip(r-4.4)httptest2_1.1.0.9000.zip(r-4.3)
httptest2_1.1.0.9000.tgz(r-4.4-any)httptest2_1.1.0.9000.tgz(r-4.3-any)
httptest2_1.1.0.9000.tar.gz(r-4.5-noble)httptest2_1.1.0.9000.tar.gz(r-4.4-noble)
httptest2_1.1.0.9000.tgz(r-4.4-emscripten)httptest2_1.1.0.9000.tgz(r-4.3-emscripten)
httptest2.pdf |httptest2.html✨
httptest2/json (API)
NEWS
# Install 'httptest2' in R: |
install.packages('httptest2', repos = c('https://nealrichardson.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/nealrichardson/httptest2/issues
Last updated 4 months agofrom:5856ed57a5. Checks:OK: 7. Indexed: yes.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Nov 13 2024 |
R-4.5-win | OK | Nov 13 2024 |
R-4.5-linux | OK | Nov 13 2024 |
R-4.4-win | OK | Nov 13 2024 |
R-4.4-mac | OK | Nov 13 2024 |
R-4.3-win | OK | Nov 13 2024 |
R-4.3-mac | OK | Nov 13 2024 |
Exports:.mockPathsblock_requestsbuild_mock_urlcapture_requestschange_stateend_vignetteexpect_DELETEexpect_GETexpect_no_requestexpect_PATCHexpect_POSTexpect_PUTexpect_request_headerfind_mock_fileget_current_redactorgsub_responseredact_cookiesredact_headerssave_responseset_redactorstart_capturingstart_vignettestop_capturingstop_mockinguse_httptest2use_mock_apiwith_mock_apiwith_mock_dirwith_tracewithin_body_textwithout_internet
Dependencies:askpassbriocallrclicrayoncurldescdiffobjdigestevaluatefsgluehttr2jsonlitelifecyclemagrittropensslpkgbuildpkgloadpraiseprocessxpsR6rappdirsrlangrprojrootsystestthatvctrswaldowithr
Frequently Asked Questions
Rendered fromfaq.Rmd
usingknitr::rmarkdown
on Nov 13 2024.Last update: 2023-07-06
Started: 2020-12-15
httptest: A Test Environment for HTTP Requests in R
Rendered fromhttptest2.Rmd
usingknitr::rmarkdown
on Nov 13 2024.Last update: 2022-01-02
Started: 2021-12-29
Redacting and Modifying Recorded Requests
Rendered fromredacting.Rmd
usingknitr::rmarkdown
on Nov 13 2024.Last update: 2021-12-29
Started: 2017-10-08
Writing Vignettes with APIs
Rendered fromvignettes.Rmd
usingknitr::rmarkdown
on Nov 13 2024.Last update: 2021-12-30
Started: 2018-01-12
Readme and manuals
Help Manual
Help page | Topics |
---|---|
Set an alternate directory for mock API fixtures | .mockPaths |
Record API responses as mock files | capture_requests start_capturing stop_capturing |
Handle a change of server state | change_state |
Test that an HTTP request is made with a header | expect_request_header |
Expectations for mocked HTTP requests | expect_DELETE expect_GET expect_no_request expect_PATCH expect_POST expect_PUT expect_verb |
Find and replace within a response object | gsub_response |
Remove sensitive content from HTTP responses | redact redact_cookies redact_headers within_body_text |
Set a response redactor | set_redactor |
Set mocking/capturing state for a vignette | end_vignette start_vignette |
Use 'httptest2' in your tests | use_httptest2 |
Serve a mock API from files | stop_mocking use_mock_api with_mock_api |
Use or create mock files depending on their existence | with_mock_dir |
Make all HTTP requests raise an error | block_requests without_internet |