curl (version 2.3)

parse_headers: Parse response headers

Description

Parse response header data as returned by curl_fetch If the request has followed redirects, the data can contain multiple sets of headers. Therefore 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.

Usage

parse_headers(txt, multiple = FALSE)

Arguments

txt
raw or character vector with the header data
multiple
parse multiple sets of headers separated by a blank line. See details.

Examples

Run this code
req <- curl_fetch_memory("https://httpbin.org/redirect/3")
parse_headers(req$headers)
parse_headers(req$headers, multiple = TRUE)

Run the code above in your browser using DataLab