R/resp-request.R

Defines functions resp_request

Documented in resp_request

#' Find the request responsible for a response
#'
#' To make debugging easier, httr2 includes the request that was used to
#' generate every response. You can use this function to access it.
#'
#' @inheritParams resp_header
#' @export
#' @examples
#' req <- request(example_url())
#' resp <- req_perform(req)
#' resp_request(resp)
resp_request <- function(resp) {
  check_response(resp)

  resp$request
}

Try the httr2 package in your browser

Any scripts or data that you put into this service are public.

httr2 documentation built on April 3, 2025, 10:56 p.m.