if (FALSE) {
# Make a stub
stub1 <- StubbedRequest$new(method = "get", uri = "api.crossref.org")
stub1$with(headers = list("User-Agent" = "R"))
stub1$to_return(status = 200, body = "foobar", headers = list())
stub1
# Make another stub
stub2 <- StubbedRequest$new(method = "get", uri = "api.crossref.org")
stub2
# Put both stubs in the stub registry
reg <- StubRegistry$new()
reg$register_stub(stub = stub1)
reg$register_stub(stub = stub2)
reg
reg$request_stubs
}
Run the code above in your browser using DataLab