req_verbose() uses the following prefixes to distinguish between
different components of the HTTP requests and responses:
* informative curl messages
-> request headers
>> request body
<- response headers
<< response body
req_verbose(
req,
header_req = TRUE,
header_resp = TRUE,
body_req = FALSE,
body_resp = FALSE,
info = FALSE,
redact_headers = TRUE
)A httr2 request object.
Show request/response headers?
Should request/response bodies? When the response body is compressed, this will show the number of bytes received in each "chunk".
Show informational text from curl? This is mainly useful for debugging https and auth problems, so is disabled by default.
Redact confidential data in the headers? Currently redacts the contents of the Authorization header to prevent you from accidentally leaking credentials when debugging/reprexing.
A modified HTTP request.
req_perform() which exposes a limited subset of these options
through the verbosity argument and with_verbosity() which allows you
to control the verbosity of requests deeper within the call stack.
# Use `req_verbose()` to see the headers that are sent back and forth when
# making a request
resp <- request("https://httr2.r-lib.org") |>
req_verbose() |>
req_perform()
#> -> GET / HTTP/2
#> -> Host: httr2.r-lib.org
#> -> user-agent: httr2/1.2.1 r-curl/6.4.0 libcurl/7.81.0
#> -> accept: */*
#> -> accept-encoding: deflate, gzip, br, zstd
#> ->
#> <- HTTP/2 200
#> <- server: GitHub.com
#> <- content-type: text/html; charset=utf-8
#> <- last-modified: Thu, 24 Jul 2025 14:49:24 GMT
#> <- access-control-allow-origin: *
#> <- etag: W/"688247f4-4ae0"
#> <- expires: Tue, 29 Jul 2025 17:48:48 GMT
#> <- cache-control: max-age=600
#> <- content-encoding: gzip
#> <- x-proxy-cache: MISS
#> <- x-github-request-id: 08C2:2C9EE1:1FC6674:220D099:68890727
#> <- accept-ranges: bytes
#> <- date: Tue, 29 Jul 2025 19:05:14 GMT
#> <- via: 1.1 varnish
#> <- age: 17
#> <- x-served-by: cache-cmh1290081-CMH
#> <- x-cache: HIT
#> <- x-cache-hits: 1
#> <- x-timer: S1753815914.333707,VS0,VE1
#> <- vary: Accept-Encoding
#> <- x-fastly-request-id: 24a2685114b093ba15889ba6a56b07fd5f8ed944
#> <- content-length: 4768
#> <-
# Or use one of the convenient shortcuts:
resp <- request("https://httr2.r-lib.org") |>
req_perform(verbosity = 1)
#> -> GET / HTTP/2
#> -> Host: httr2.r-lib.org
#> -> user-agent: httr2/1.2.1 r-curl/6.4.0 libcurl/7.81.0
#> -> accept: */*
#> -> accept-encoding: deflate, gzip, br, zstd
#> ->
#> <- HTTP/2 200
#> <- server: GitHub.com
#> <- content-type: text/html; charset=utf-8
#> <- last-modified: Thu, 24 Jul 2025 14:49:24 GMT
#> <- access-control-allow-origin: *
#> <- etag: W/"688247f4-4ae0"
#> <- expires: Tue, 29 Jul 2025 17:48:48 GMT
#> <- cache-control: max-age=600
#> <- content-encoding: gzip
#> <- x-proxy-cache: MISS
#> <- x-github-request-id: 08C2:2C9EE1:1FC6674:220D099:68890727
#> <- accept-ranges: bytes
#> <- date: Tue, 29 Jul 2025 19:05:14 GMT
#> <- via: 1.1 varnish
#> <- age: 17
#> <- x-served-by: cache-cmh1290081-CMH
#> <- x-cache: HIT
#> <- x-cache-hits: 2
#> <- x-timer: S1753815914.349646,VS0,VE0
#> <- vary: Accept-Encoding
#> <- x-fastly-request-id: a25951ab950102363609f224bbb610ab21d2a466
#> <- content-length: 4768
#> <-