1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parse_headers.R
\name{parse_headers}
\alias{parse_headers}
\alias{parse_headers_list}
\title{Parse response headers}
\usage{
parse_headers(txt, multiple = FALSE)
parse_headers_list(txt)
}
\arguments{
\item{txt}{raw or character vector with the header data}
\item{multiple}{parse multiple sets of headers separated by a blank line. See details.}
}
\description{
Parse response header data as returned by curl_fetch, either as a set of strings
or into a named list.
}
\details{
The parse_headers_list function parses the headers into a normalized (lowercase
field names, trimmed whitespace) named list.
If a request has followed redirects, the data can contain multiple sets of headers.
When multiple = TRUE, the function returns a list with the response headers
for each request. By default it only returns the headers of the final request.
}
\examples{
req <- curl_fetch_memory("https://hb.cran.dev/redirect/3")
parse_headers(req$headers)
parse_headers(req$headers, multiple = TRUE)
# Parse into named list
parse_headers_list(req$headers)
}
|