There are three steps needed to perform a HTTP request with httr2:
Create a request object with
request(url)
(this function).Define its behaviour with
req_
functions, e.g.:req_headers()
to set header values.req_url_path()
and friends to modify the url.req_body_json()
and friends to add a body.req_auth_basic()
to perform basic HTTP authentication.req_oauth_auth_code()
to use the OAuth auth code flow.
Perform the request and fetch the response with
req_perform()
.