How to make a POST request with header and data options in R using httr::POST?
问题 I am trying make a POST request with data and header information using httr::POST . I can see how to make a POST request, but I am unable to get it to work with curl's data ( -d ) and header ( -H ) options. This works perfectly in my terminal (obviously with different data/api, but exactly the same format) curl -H "Accept: application/json" -H "Content-type: application/json" -d '{"name": "Fred", "age": "5"}' "http://www.my-api.com" Question How can the above POST request be made (with