record: Record an httr method.

Description Usage Arguments Examples

View source: R/record.R

Description

Record an httr method.

Usage

1
2
record(expr, method = httr::GET, file = "vcr.txt", snapshot = FALSE,
  callback = function(r) capture.output(dput(r)))

Arguments

expr

call. The expression to evaluate and record.

method

function. The function in httr to run recording for.

file

character. A path to the file where the recording should be written.

snapshot

logical. If snapshot is true, an RDS tape of the response will be written.

callback

function. A function to process the response prior to recording to a file.

Examples

1
2
3
4
5
## Not run: 
    # Record the JSON from an API call
    record(mypackage::MyAPICall(), callback = function(r) jsonlite::toJSON(httr::content(r), pretty = TRUE))

## End(Not run)

peterhurford/vcr documentation built on Jan. 22, 2020, 8:12 p.m.