R/get-response-headers.R

Defines functions get_response_headers

get_response_headers <- function(url, ...) {

  tryCatch(
    httr::HEAD(url, ...),
    error = function(e) stop(e)
  ) -> res

  httr::warn_for_status(res)

  list(
    hdrs = httr::headers(res),
    scheme = httr::parse_url(res$url)[["scheme"]]
  ) -> out

  invisible(out)

}
hrbrmstr/hdrs documentation built on May 23, 2019, 4 a.m.