resp_headers | R Documentation |
resp_headers()
retrieves a list of all headers.
resp_header()
retrieves a single header.
resp_header_exists()
checks if a header is present.
resp_headers(resp, filter = NULL)
resp_header(resp, header, default = NULL)
resp_header_exists(resp, header)
resp |
A httr2 response object, created by |
filter |
A regular expression used to filter the header names.
|
header |
Header name (case insensitive) |
default |
Default value to use if header doesn't exist. |
resp_headers()
returns a list.
resp_header()
returns a string if the header exists and NULL
otherwise.
resp_header_exists()
returns TRUE
or FALSE
.
resp <- request("https://httr2.r-lib.org") |> req_perform()
resp |> resp_headers()
resp |> resp_headers("x-")
resp |> resp_header_exists("server")
resp |> resp_header("server")
# Headers are case insensitive
resp |> resp_header("SERVER")
# Returns NULL if header doesn't exist
resp |> resp_header("this-header-doesnt-exist")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.