httptest
A Test Environment for HTTP Requests
Description
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.
Downloads
5.1K
Last 30 days
1692nd
13.9K
Last 90 days
50.1K
Last year
Trend: -7.3% (30d vs prior 30d)
16
Last 30 days
44
Last 90 days
190
Last year
Trend: -11.1% (30d vs prior 30d)
CRAN Check Status
Show all 13 flavors
| Flavor | Status |
|---|---|
| r-devel-linux-x86_64-debian-clang | OK |
| r-devel-linux-x86_64-debian-gcc | OK |
| r-devel-linux-x86_64-fedora-clang | OK |
| r-devel-linux-x86_64-fedora-gcc | OK |
| r-devel-windows-x86_64 | OK |
| r-oldrel-macos-arm64 | OK |
| r-oldrel-macos-x86_64 | OK |
| r-oldrel-windows-x86_64 | OK |
| r-patched-linux-x86_64 | OK |
| r-release-linux-x86_64 | OK |
| r-release-macos-arm64 | OK |
| r-release-macos-x86_64 | OK |
| r-release-windows-x86_64 | OK |
Check History
OK 13 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Jun 9, 2026
ERROR 12 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Jun 8, 2026
tests
Running ‘spelling.R’ [0s/0s]
Running ‘testthat.R’ [8s/10s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> test_check("httptest")
Loading required package: httptest
Saving _problems/test-find-redactor-
...[truncated]...
──
Error in `detach("package:testpkg", unload = TRUE)`: invalid 'name' argument
Backtrace:
▆
1. └─base::detach("package:testpkg", unload = TRUE)
[ FAIL 3 | WARN 0 | SKIP 13 | PASS 285 ]
Error:
! Test failures.
Execution halted