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

Unexpected conversion using -d #11

Open johndharrison opened 8 years ago

johndharrison commented 8 years ago

Using -d we expect to see a body argument in the VERB:

> "curl -X POST -d 'a=8089' http://abcdef.org"  %>% straighten  %>% make_req -> uu
curl -X POST -d 'a=8089' http://abcdef.org
> uu
[[1]]
function () 
httr::VERB(verb = "POST", url = "http://abcdef.org")
<environment: 0x5742460>

--data correctly adds the body argument:

> "curl -X POST --data 'a=8089' http://abcdef.org"  %>% straighten  %>% make_req -> uu
curl -X POST --data 'a=8089' http://abcdef.org
> uu
[[1]]
function () 
httr::VERB(verb = "POST", url = "http://abcdef.org", body = list(a = "8089"))
<environment: 0x550e248>