RequestHandlerHttr2 {vcr} | R Documentation |
RequestHandlerHttr2
Description
Methods for the httr2 package, building on RequestHandler
Super class
vcr::RequestHandler
-> RequestHandlerHttr2
Methods
Public methods
Inherited methods
Method new()
Create a new RequestHandlerHttr2
object
Usage
RequestHandlerHttr2$new(request)
Arguments
request
The request from an object of class
HttpInteraction
Returns
A new RequestHandlerHttr2
object
Method clone()
The objects of this class are cloneable with this method.
Usage
RequestHandlerHttr2$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## Not run:
# GET request
library(httr2)
req <- request("https://hb.opencpu.org/post") %>%
req_body_json(list(foo = "bar"))
x <- RequestHandlerHttr2$new(req)
# x$handle()
# POST request
library(httr2)
mydir <- file.path(tempdir(), "testing_httr2")
invisible(vcr_configure(dir = mydir))
req <- request("https://hb.opencpu.org/post") %>%
req_body_json(list(foo = "bar"))
use_cassette(name = "testing3", {
response <- req_perform(req)
}, match_requests_on = c("method", "uri", "body"))
use_cassette(name = "testing3", {
response2 <- req_perform(req)
}, match_requests_on = c("method", "uri", "body"))
## End(Not run)
[Package vcr version 1.6.0 Index]