% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/httr2-translate.R
\name{httr2_translate}
\alias{httr2_translate}
\title{Translate a httr2 request to a curl command}
\usage{
httr2_translate(req, obfuscated = c("redact", "reveal"))
}
\arguments{
\item{req}{A httr2 \link{request} object.}

\item{obfuscated}{Form and JSON bodies can contain \link{obfuscated} values.
This argument control what happens to them: should they be removed,
redacted, or revealed.}
}
\value{
A string containing the curl command.
}
\description{
Convert a httr2 request object to an approximate curl command line call.
This is useful for debugging, for sharing a request with someone who doesn't
use R, or for handing off to another tool.
}
\examples{
# Basic GET request
request("https://httpbin.org/get") |>
  httr2_translate()

# POST with JSON body
request("https://httpbin.org/post") |>
  req_body_json(list(name = "value")) |>
  httr2_translate()

# Secrets are redacted by default, but can be revealed
request("https://example.com") |>
  req_headers_redacted(Authorization = "secret") |>
  httr2_translate(obfuscated = "reveal")
}
\seealso{
\code{\link[=curl_translate]{curl_translate()}} to translate in the other direction.
}
