resp_status {httr2}R Documentation

Extract HTTP status from response

Description

These functions are mostly for internal use because in most cases you will only ever see a 200 response:

Usage

resp_status(resp)

resp_status_desc(resp)

resp_is_error(resp)

resp_check_status(resp, info = NULL, error_call = caller_env())

Arguments

resp

An HTTP response object, as created by req_perform().

info

A character vector of additional information to include in the error message. Passed to rlang::abort().

error_call

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 call argument of abort() for more information.

Value

Examples

# An HTTP status code you're unlikely to see in the wild:
resp <- response(418)
resp |> resp_is_error()
resp |> resp_status()
resp |> resp_status_desc()

[Package httr2 version 1.0.1 Index]