Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以使用 Faraday (Faraday.head url) 执行HEAD请求,但我在当前项目中使用 Mechanize。
HEAD
我想在不下载文件的情况下从标题(文件名)中获取一个值。机械化宝石是否提供这样的选项?我正在使用 v2.0。
就像get但它head相反:
get
head
page = agent.head 'http://www.google.com/' page.body.length #=> 0 page.header.keys #=> ["date", "expires", "cache-control", "content-type", "set-cookie", "p3p", "server", "x-xss-protection", "x-frame-options", "transfer-encoding"]