Retrieve custom headers set on the request. Use req_dry_run()
to get all
headers, including those automatically generated by curl.
Usage
req_get_headers(req, redacted = c("drop", "redact", "reveal"))
Arguments
- req
A httr2 request object.
- redacted
What to do with redacted headers?
"drop"
(the default) drops them."redact"
replaces them with<REDACTED>
."reveal"
leaves them in place.
Examples
req <- request("http://example.com")
req <- req_headers(req, a = 1L, b = 2L, .redact = "a")
req_get_headers(req, "drop")
#> $b
#> [1] "2"
#>
req_get_headers(req, "redact")
#> $a
#> [1] "<REDACTED>"
#>
#> $b
#> [1] "2"
#>
req_get_headers(req, "reveal")
#> $a
#> [1] "1"
#>
#> $b
#> [1] "2"
#>