Takes the output of straighten() and turns the parsed cURL command lines into working httr VERB() functions, optionally cat'ing the text of each function to the console and/or replacing the system clipboard with the source code for the function.

make_req(x, use_parts = FALSE, quiet = TRUE, add_clip = (length(x) == 1))

Arguments

x

a vector of curlcoverter objects

use_parts

logical. If TRUE, the request function will be generated from the "URL parts" that are created as a result of the call to straighten. This is useful if you want to modify the URL parts before calling make_req. Default: FALSE.

quiet

if FALSE, will cause make_req() to write complete function source code to the console.

add_clip

if TRUE, will overwrite the system clipboard with the character string contents of the last newly made `httr::VERB` function (i.e. this is intended to be used in a workflow where only one cURL command line is being processed). Defaults to TRUE if length(x) is 1

Value

a list of working R functions.

References

Evaluating Network Performance, Network Monitor

See also

straighten(), httr VERB()

Examples

if (FALSE) {
library(httr)

my_ip <- straighten("curl 'https://httpbin.org/ip'") %>% make_req()

# external test which captures live data
content(my_ip[[1]](), as="parsed")
}

curl_line <- readLines(system.file("extdata/curl8.txt", package="curlconverter"),
                       warn=FALSE)
st <- straighten(curl_line, quiet=FALSE)
req <- make_req(st)