hrbrmstr / curlconverter

:curly_loop: :arrow_right: :heavy_minus_sign: Translate cURL command lines into parameters for use with httr or actual httr calls (R)
http://rud.is/b/2016/02/10/craft-httr-calls-cleverly-with-curlconverter/
Other
91 stars 12 forks source link

Error on valid command #23

Open eliocamp opened 5 years ago

eliocamp commented 5 years ago

I was trying to figure out how to use curl's --head flag in R and found your package. However, it threw an error, even though the command is valid.

library(curlconverter)
#> Loading required package: httr

cur <- "curl -s --head -X GET www.google.com"

head(system(cur, intern = TRUE))
#> [1] "HTTP/1.1 200 OK\r"                                                      
#> [2] "Date: Fri, 30 Aug 2019 23:37:50 GMT\r"                                  
#> [3] "Expires: -1\r"                                                          
#> [4] "Cache-Control: private, max-age=0\r"                                    
#> [5] "Content-Type: text/html; charset=ISO-8859-1\r"                          
#> [6] "P3P: CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"\r"

straighten(cur)
#> curl -s --head -X GET www.google.com
#> Error: 
#>  usage: curl [<url>] [-H LINE ...] [-X COMMAND <url>] [-X COMMAND] [--request COMMAND] [--request COMMAND <url>] [options] [<url>]

Maybe is it that neither httr or curl implement the --head flag? I'm looking all over the documentation and not finding it :sob: