Skip to contents

The non-JSON counterpart to perform(), for a source that ships a bulk flat file rather than a per-record JSON API. The body lands in data as a single string, so the envelope shape is the same either way and a caller does not branch on which wrapper it used.

Usage

perform_text(req, source = "API", secret_query = NULL)

Arguments

req

An httr2 request, prepared with req_defaults().

source

A friendly label for the service, used in the user-facing message. For example "gnomAD".

secret_query

A named list of query-string credentials. Appended here rather than by the caller, so req itself never carries them and neither does anything built from req$url. See redact_secrets().

Value

An envelope whose data is a single string on success.

Details

The breaker rule is the same one: only a transport failure counts against the host.

Examples

breaker_reset()
req <- req_defaults(httr2::request("https://mock.test/genes.tsv"))

httr2::with_mocked_responses(
  list(httr2::response(
    status_code = 200,
    body = charToRaw("gene\tscore\n")
  )),
  perform_text(req, "ClinGen")$data
)
#> [1] "gene\tscore\n"