req_get_body_type | R Documentation |
This pair of functions gives you sufficient information to capture the body of a request, and recreate, if needed. httr2 currently supports seven possible body types:
empty: no body.
raw: created by req_body_raw()
with a raw vector.
string: created by req_body_raw()
with a string.
file: created by req_body_file()
.
json: created by req_body_json()
/req_body_json_modify()
.
form: created by req_body_form()
.
multipart: created by req_body_multipart()
.
req_get_body_type(req)
req_get_body(req, obfuscated = c("remove", "redact", "reveal"))
req |
A httr2 request object. |
obfuscated |
Form and JSON bodies can contain obfuscated values. This argument control what happens to them: should they be removed, redacted, or revealed. |
req <- request(example_url())
req |> req_body_raw("abc") |> req_get_body_type()
req |> req_body_file(system.file("DESCRIPTION")) |> req_get_body_type()
req |> req_body_json(list(x = 1, y = 2)) |> req_get_body_type()
req |> req_body_form(x = 1, y = 2) |> req_get_body_type()
req |> req_body_multipart(x = "x", y = "y") |> req_get_body_type()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.