if (FALSE) {
# make the request
library(vcr)
url <- "https://hb.opencpu.org/post"
body <- list(foo = "bar")
cli <- crul::HttpClient$new(url = url)
res <- cli$post(body = body)
# build a Request object
(request <- Request$new("POST", uri = url,
body = body, headers = res$response_headers))
# build a VcrResponse object
(response <- VcrResponse$new(
res$status_http(),
res$response_headers,
res$parse("UTF-8"),
res$response_headers$status))
# make HTTPInteraction object
(x <- HTTPInteraction$new(request = request, response = response))
x$recorded_at
x$to_hash()
# make an HTTPInteraction from a hash with the object already made
x$from_hash(x$to_hash())
# Make an HTTPInteraction from a hash alone
my_hash <- x$to_hash()
HTTPInteraction$new()$from_hash(my_hash)
}
Run the code above in your browser using DataLab