Perform a requestSource:
req_perform( req, path = NULL, verbosity = NULL, mock = getOption("httr2_mock", NULL), error_call = current_env() )
Optionally, path to save body of request. This is useful for large responses since it avoids storing the response in memory.
How much information to print? This is a wrapper around
req_verbose()that uses an integer to control verbosity:
0: no output
1: show headers
2: show headers and bodies
3: show headers, bodies, and curl status messages.
with_verbosity()to control the verbosity of requests that you can't affect directly.
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). See
local_mock()for more details.
The execution environment of a currently running function, e.g.
caller_env(). The function will be mentioned in error messages as the source of the error. See the
abort()for more information.
If request is successful (i.e. the request was successfully
performed and a response with HTTP status code <400 was recieved), an HTTP
response; otherwise throws an error. Override this behaviour with
Note that one call to
req_perform() may perform multiple HTTP requests:
urlis redirected with a 301, 302, 303, or 307, curl will automatically follow the
Locationheader to the new location.
If you are using OAuth, and the cached token has expired,
req_perform()will get a new token either using the refresh token (if available) or by running the OAuth flow.