HTTPInteractionList | R Documentation |
keeps track of all HTTPInteraction objects
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)
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
new()
Create a new HTTPInteractionList
object
HTTPInteractionList$new( interactions, request_matchers, allow_playback_repeats = FALSE, parent_list = NullList$new(), used_interactions = list() )
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
A new HTTPInteractionList
object
response_for()
Check if there's a matching interaction, returns a response object
HTTPInteractionList$response_for(request)
request
The request from an object of class HTTPInteraction
has_interaction_matching()
Check if has a matching interaction
HTTPInteractionList$has_interaction_matching(request)
request
The request from an object of class HTTPInteraction
logical
has_used_interaction_matching()
check if has used interactions matching a given request
HTTPInteractionList$has_used_interaction_matching(request)
request
The request from an object of class HTTPInteraction
logical
remaining_unused_interaction_count()
Number of unused interactions
HTTPInteractionList$remaining_unused_interaction_count()
integer
assert_no_unused_interactions()
Checks if there are no unused interactions left.
HTTPInteractionList$assert_no_unused_interactions()
various
clone()
The objects of this class are cloneable with this method.
HTTPInteractionList$clone(deep = FALSE)
deep
Whether to make a deep clone.
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.