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.

Package details

AuthorNeal Richardson [aut, cre] (<https://orcid.org/0009-0002-7992-3520>), Jonathan Keane [ctb], Maëlle Salmon [ctb] (<https://orcid.org/0000-0002-2815-0399>)
MaintainerNeal Richardson <neal.p.richardson@gmail.com>
LicenseMIT + file LICENSE
Version4.2.1
URL https://enpiar.com/r/httptest/ https://github.com/nealrichardson/httptest
Package repositoryView on CRAN
Installation Install the latest version of this package by entering the following in R:
install.packages("httptest")

Try the httptest package in your browser

Any scripts or data that you put into this service are public.

httptest documentation built on July 9, 2023, 7:45 p.m.