Convenience wrapper around a bunch of httr2 functions.
Value
If the HTTP request succeeds, and the status code is ok (e.g. 200), an HTTP response.
If the HTTP request succeeds, but the status code is an error (e.g a 404), an error with class
c("httr2_http_404", "httr2_http")
. By default, all 400 and 500 status codes will be treated as an error, but you can customise this withreq_error()
.If the HTTP request fails (e.g. the connection is dropped or the server doesn't exist), an error with class
"httr2_failure"
.
See also
Other HTTP functions:
assert_mime_type()
,
is_http_success()
,
is_url()