Skip to content

All responses contain a request date in the Date header; if not provided by the server will be automatically added by httr2.

Usage

resp_date(resp)

Arguments

resp

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

Value

A POSIXct date-time.

Examples

resp <- response(headers = "Date: Wed, 01 Jan 2020 09:23:15 UTC")
resp |> resp_date()
#> [1] "2020-01-01 09:23:15 UTC"

# If server doesn't add header (unusual), you get the time the request
# was created:
resp <- response()
resp |> resp_date()
#> [1] "2020-01-01 UTC"