Debian Codegraph @

man/parse_headers.Rd

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