make_req: Turn parsed cURL command lines into 'httr' request functions

Description Usage Arguments Value References See Also Examples

Description

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.

Usage

1
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

1
2
3
4
5
6
7
8
9
library(httr)

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

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

## End(Not run)

curlconverter documentation built on Jan. 15, 2017, 3:04 p.m.