Skip to contents

This function ensures that a request has httr2::req_retry() applied, and then performs the request, using either httr2::req_perform_iterative() (if a next_req function is supplied) or httr2::req_perform() (if not).

Usage

req_perform_opinionated(
  req,
  ...,
  next_req = NULL,
  max_reqs = 2,
  max_tries_per_req = 3
)

Arguments

req

The first request to perform.

...

These dots are for future extensions and must be empty.

next_req

An optional function that takes the previous response (resp) to generate the next request in a call to httr2::req_perform_iterative(). This function can usually be generated using one of the iteration helpers described in httr2::iterate_with_offset().

max_reqs

The maximum number of separate requests to perform. Passed to the max_reqs argument of httr2::req_perform_iterative() when next_req is supplied. The default 2 should likely be changed to Inf after you validate the function.

max_tries_per_req

The maximum number of times to attempt each individual request. Passed to the max_tries argument of httr2::req_retry().

Value

A list of httr2::response() objects, one for each request performed.