Skip to contents

Process httr2 response object

Usage

resp_process(resp, output = c("df", "jsonlist", "raw", "resp", "text"))

Arguments

resp

A httr2 response object.

output

The output format. Default is "df". Other options are "jsonlist", "raw", "resp" (httr2 response object), "text"

Value

A data frame, json list, raw or httr2 response object.

Examples

if (FALSE) { # test_connection()$status_code == 200
resp <- list_models("resp")
resp_process(resp, "df") # parse response to dataframe/tibble
resp_process(resp, "jsonlist") # parse response to list
resp_process(resp, "raw") # parse response to raw string
resp_process(resp, "resp") # return input response object
resp_process(resp, "text") # return text/character vector
}