forked from r-lib/httr2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurl_translate.Rd
More file actions
49 lines (46 loc) · 1.67 KB
/
Copy pathcurl_translate.Rd
File metadata and controls
49 lines (46 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/curl.R
\name{curl_translate}
\alias{curl_translate}
\alias{curl_help}
\title{Translate a curl command to a httr2 request}
\usage{
curl_translate(cmd, simplify_headers = TRUE)
curl_help()
}
\arguments{
\item{cmd}{Call to curl. If omitted and the clipr package is installed,
will be retrieved from the clipboard.}
\item{simplify_headers}{Remove typically unimportant headers included when
copying a curl command from the browser. This includes:
\itemize{
\item \verb{sec-fetch-*}
\item \verb{sec-ch-ua*}
\item \code{referer}, \code{pragma}, \code{connection}
}}
}
\value{
A string containing the translated httr2 code. If the input
was copied from the clipboard, the translation will be copied back
to the clipboard.
}
\description{
The curl command line tool is commonly used to demonstrate HTTP APIs and can
easily be generated from
\href{https://everything.curl.dev/cmdline/copyas.html}{browser developer tools}.
\code{curl_translate()} saves you the pain of manually translating these calls
by implementing a partial, but frequently used, subset of curl options.
Use \code{curl_help()} to see the supported options, and \code{curl_translate()}
to translate a curl invocation copy and pasted from elsewhere.
Inspired by \href{https://github.com/hrbrmstr/curlconverter}{curlconverter}
written by \href{https://rud.is/b/}{Bob Rudis}.
}
\examples{
curl_translate("curl http://example.com")
curl_translate("curl http://example.com -X DELETE")
curl_translate("curl http://example.com --header A:1 --header B:2")
curl_translate("curl http://example.com --verbose")
}
\seealso{
\code{\link[=httr2_translate]{httr2_translate()}}
}