Wrapper around httr2::req_perform()
that
sends API request and fetches response body.
Also, adds relevant object class for use with
parsing functions; See dk_resp_parse()
.
Arguments
- req
A request.
- path
Optionally, path to save body of the response. This is useful for large responses since it avoids storing the response in memory.
- verbosity
How much information to print? This is a wrapper around
req_verbose()
that uses an integer to control verbosity:0
: no output1
: show headers2
: show headers and bodies3
: show headers, bodies, and curl status messages.
Use
with_verbosity()
to control the verbosity of requests that you can't affect directly.- mock
A mocking function. If supplied, this function is called with the request. It should return either
NULL
(if it doesn't want to handle the request) or a response (if it does). Seewith_mock()
/local_mock()
for more details.- output
One of 'json' or 'response'.
- objclass
character. Name of class to assign to output object. Default is NULL, and no additional class is assigned. Used to facilitate parsing; See
dk_resp_parse()
.