随后,摘自How translate this curl command into a R curl call?
我可以成功执行curl请求,但是返回的结果看起来是二进制格式,但是内容应该是ASCII。如何将其写为ASCII文件?
require(httr)
headers = c(
`Content-Type` = 'text/csv'
)
data = upload_file('data/data.csv')
res <- httr::POST(url = 'https://some.url.com/invocations', httr::add_headers(.headers=headers), body = data)
答案 0 :(得分:0)
content(res, "text")
有效,如果输出为JSON,则
content(res, "parsed")
也可以。