HTTParty.head检索MP3

时间:2015-06-19 14:50:37

标签: ruby-on-rails httparty

我正在使用HTTParty检查某些mp3的运行状况,所以我只想提出头请求并查看响应代码。但是,当我在mp3上使用HTTParty.head时,我收到了完整的响应。

例如,response = HTTParty.head("https://archive.org/download/is-los-angeles-still-a-city-of-quartz.LYaAW6.popuparchive.org/ww_2015-06-18-202413.6929.mp3")

使用curl按预期工作curl -IL https://archive.org/download/is-los-angeles-still-a-city-of-quartz.LYaAW6.popuparchive.org/ww_2015-06-18-202413.6929.mp3

1 个答案:

答案 0 :(得分:3)

Here's你在GitHub上寻找的问题。其中一个答案有效(似乎是重定向的问题):

HTTParty.head("https://archive.org/download/is-los-angeles-still-a-city-of-quartz.LYaAW6.popuparchive.org/ww_2015-06-18-202413.6929.mp3", follow_redirects: true, maintain_method_across_redirects: true)