redact_cookies {httptest} | R Documentation |
Remove sensitive content from HTTP responses
Description
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.
Usage
redact_cookies(response)
redact_headers(response, headers = c())
within_body_text(response, FUN)
redact_auth(response)
Arguments
response |
An 'httr' |
headers |
For |
FUN |
For |
Details
redact_cookies()
removes cookies from 'httr' response
objects.
redact_headers()
lets you target selected request and response headers for
redaction. redact_auth()
is a convenience wrapper around
them for a useful default redactor in capture_requests()
.
within_body_text()
lets you manipulate the text of the response body
and manages the parsing of the raw (binary) data in the 'response' object.
Value
All redacting functions return a well-formed 'httr' response
object.
See Also
vignette("redacting", package="httptest")
for a detailed discussion of what these functions do and how to customize them. gsub_response()
is another redactor.