【发布时间】:2012-02-22 21:52:10
【问题描述】:
我一直使用 open-uri 和 open("").read 通过 http 获取内容。我正在使用它来访问 API,现在我需要指定接受什么内容类型。他们从 curl 中提供了这个例子
curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1038/nrd842
如何使用 open-uri 或其他 Ruby 函数执行此操作?
【问题讨论】:
标签: ruby http content-type open-uri