as-redactor: Wrap a redacting expression as a proper function

as.redactorR Documentation

Wrap a redacting expression as a proper function

Description

Redactors take a response as their first argument, and some take additional arguments: redact_headers(), for example, requires that you specify headers. This function allows you to take a simplified expression via a formula, similar to what purrr does, so that you can provide the function to capture_requests().

Usage

as.redactor(fmla)

Arguments

fmla

Partial expression (a formula) to turn into a function

Details

For example, as.redactor(~ redact_headers(., "X-Custom-Header")) is equivalent to function (response) redact_headers(response, "X-Custom-Header"). This allows you to do set_redactor(~ redact_headers(., "X-Custom-Header")).

Value

A function.

See Also

capture_requests()


nealrichardson/httptest documentation built on Feb. 5, 2024, 12:35 a.m.