http_interactions: Get the http interactions of the current cassette

View source: R/http_interactions.R

http_interactionsR Documentation

Get the http interactions of the current cassette

Description

Get the http interactions of the current cassette

Usage

http_interactions()

Value

object of class HTTPInteractionList if there is a current cassette in use, or NullList if no cassette in use

Examples

## Not run: 
vcr_configure(dir = tempdir())
insert_cassette("foo_bar")
webmockr::webmockr_allow_net_connect()
library(crul)
cli <- crul::HttpClient$new("https://eu.httpbin.org/get")
one <- cli$get(query = list(a = 5))
z <- http_interactions()
z
z$interactions
z$used_interactions
# on eject, request written to the cassette
eject_cassette("foo_bar")

# insert cassette again
insert_cassette("foo_bar")
# now interactions will be present 
z <- http_interactions()
z$interactions
z$used_interactions
invisible(cli$get(query = list(a = 5)))
z$used_interactions

# cleanup
unlink(file.path(tempdir(), "foo_bar.yml"))

## End(Not run)

vcr documentation built on July 9, 2023, 5:30 p.m.