resp_date: Extract request date from response

View source: R/resp-headers.R

resp_dateR Documentation

Extract request date from response

Description

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

A httr2 response object, 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()

# If server doesn't add header (unusual), you get the time the request
# was created:
resp <- response()
resp |> resp_date()

r-lib/httr2 documentation built on Nov. 4, 2024, 11:32 p.m.