redact | R Documentation |
When recording requests for use as test fixtures, you don't want to include
secrets like authentication tokens and personal ids. These functions provide
a means for redacting this kind of content, or anything you want, from
responses that capture_requests()
saves.
redact_cookies(response)
redact_headers(response, headers = c())
within_body_text(response, FUN)
response |
An |
headers |
For |
FUN |
For |
redact_cookies()
removes cookies from httr2_response
objects
and is the default redactor in capture_requests()
.
redact_headers()
lets you target selected request and response headers for
redaction.
within_body_text()
lets you manipulate the text of the response body
and manages the parsing of the raw (binary) data in the httr_response
object.
Note that if you set a redacting function, it will also be applied to requests when loading mocks. This allows you to sanitize and/or shorten URLs in your mock files.
All redacting functions return a well-formed httr2_response
or httr2_request
object.
vignette("redacting", package = "httptest2")
for a detailed discussion of what these functions do and how to customize them. gsub_response()
is another redactor.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.