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
Usage
req_verbose(
  req,
  header_req = TRUE,
  header_resp = TRUE,
  body_req = FALSE,
  body_resp = FALSE,
  info = FALSE,
  redact_headers = TRUE
)Arguments
- req
 A httr2 request object.
- header_req, header_resp
 Show request/response headers?
- body_req, body_resp
 Should request/response bodies? When the response body is compressed, this will show the number of bytes received in each "chunk".
- info
 Show informational text from curl? This is mainly useful for debugging https and auth problems, so is disabled by default.
- redact_headers
 Redact confidential data in the headers? Currently redacts the contents of the Authorization header to prevent you from accidentally leaking credentials when debugging/reprexing.
Value
A modified HTTP request.
See also
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.
Examples
# 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.9000 r-curl/7.0.0 libcurl/8.5.0
#> -> Accept: */*
#> -> Accept-Encoding: deflate, gzip, br, zstd
#> -> 
#> <- HTTP/2 200 
#> <- server: GitHub.com
#> <- content-type: text/html; charset=utf-8
#> <- last-modified: Tue, 09 Sep 2025 12:36:59 GMT
#> <- access-control-allow-origin: *
#> <- etag: W/"68c01f6b-4ae0"
#> <- expires: Fri, 19 Sep 2025 10:05:05 GMT
#> <- cache-control: max-age=600
#> <- content-encoding: gzip
#> <- x-proxy-cache: MISS
#> <- x-github-request-id: 605D:FCC39:E8E075:10519A3:68CD2879
#> <- accept-ranges: bytes
#> <- date: Fri, 19 Sep 2025 15:30:42 GMT
#> <- via: 1.1 varnish
#> <- age: 413
#> <- x-served-by: cache-dfw-kdfw8210074-DFW
#> <- x-cache: HIT
#> <- x-cache-hits: 1
#> <- x-timer: S1758295842.065655,VS0,VE2
#> <- vary: Accept-Encoding
#> <- x-fastly-request-id: 54ed30525618e3a94f170d018c5d562aa718fbf9
#> <- 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.9000 r-curl/7.0.0 libcurl/8.5.0
#> -> Accept: */*
#> -> Accept-Encoding: deflate, gzip, br, zstd
#> -> 
#> <- HTTP/2 200 
#> <- server: GitHub.com
#> <- content-type: text/html; charset=utf-8
#> <- last-modified: Tue, 09 Sep 2025 12:36:59 GMT
#> <- access-control-allow-origin: *
#> <- etag: W/"68c01f6b-4ae0"
#> <- expires: Fri, 19 Sep 2025 10:05:05 GMT
#> <- cache-control: max-age=600
#> <- content-encoding: gzip
#> <- x-proxy-cache: MISS
#> <- x-github-request-id: 605D:FCC39:E8E075:10519A3:68CD2879
#> <- accept-ranges: bytes
#> <- date: Fri, 19 Sep 2025 15:30:42 GMT
#> <- via: 1.1 varnish
#> <- age: 413
#> <- x-served-by: cache-dfw-kdfw8210074-DFW
#> <- x-cache: HIT
#> <- x-cache-hits: 2
#> <- x-timer: S1758295842.096952,VS0,VE0
#> <- vary: Accept-Encoding
#> <- x-fastly-request-id: 6a43d349182593bec194f3decacd4db4db2b7c1e
#> <- content-length: 4768
#> <- 
