I have always used open-uri, and open(“”).read to get content through http. I am using this to access an API, and now I need to specify that what content type is accepted. They provide this example from curl
curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1038/nrd842
How do I do this with open-uri or another Ruby function?
I’d suggest using the optional options hash of open, e.g.
yields a result.
See also http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open-uri/rdoc/OpenURI.html