keeps track of all HTTPInteraction objects
Details
Private Methods
has_unused_interactions()
Are there any unused interactions? returns boolean
matching_interaction_index_for()
asdfadf
matching_used_interaction_for(request)
asdfadfs
interaction_matches_request(request, interaction)
Check if a request matches an interaction (logical)
from_hash()
Get a hash back.
request_summary(z)
Get a request summary (character)
response_summary(z)
Get a response summary (character)
Public fields
interactions
(list) list of interaction class objects
request_matchers
(character) vector of request matchers
allow_playback_repeats
whether to allow playback repeats
parent_list
A list for empty objects, see
NullList
used_interactions
(list) Interactions that have been used
Methods
Method new()
Create a new HTTPInteractionList
object
Usage
HTTPInteractionList$new(
interactions,
request_matchers,
allow_playback_repeats = FALSE,
parent_list = NullList$new(),
used_interactions = list()
)
Arguments
interactions
(list) list of interaction class objects
request_matchers
(character) vector of request matchers
allow_playback_repeats
whether to allow playback repeats or not
parent_list
A list for empty objects, see
NullList
used_interactions
(list) Interactions that have been used. That is, interactions that are on disk in the current cassette, and a request has been made that matches that interaction
Examples
if (FALSE) { # \dontrun{
vcr_configure(
dir = tempdir(),
record = "once"
)
# make interactions
## make the request
### turn off mocking
crul::mock(FALSE)
url <- "https://hb.opencpu.org/post"
cli <- crul::HttpClient$new(url = url)
res <- cli$post(body = list(a = 5))
## request
(request <- Request$new("POST", url, list(a = 5), res$headers))
## response
(response <- VcrResponse$new(
res$status_http(),
res$response_headers,
res$parse("UTF-8"),
res$response_headers$status))
## make an interaction
(inter <- HTTPInteraction$new(request = request, response = response))
# make an interactionlist
(x <- HTTPInteractionList$new(
interactions = list(inter),
request_matchers = vcr_configuration()$match_requests_on
))
x$interactions
x$request_matchers
x$parent_list
x$parent_list$response_for()
x$parent_list$has_interaction_matching()
x$parent_list$has_used_interaction_matching()
x$parent_list$remaining_unused_interaction_count()
x$used_interactions
x$allow_playback_repeats
x$interactions
x$response_for(request)
} # }