Method: URI#exists?
- Defined in:
- lib/fe_core_ext/core_ext/uri.rb
#exists? ⇒ Boolean
18 19 20 21 22 23 24 |
# File 'lib/fe_core_ext/core_ext/uri.rb', line 18 def exists? req = ::Net::HTTP.new(host, port) req.use_ssl = true if scheme == "https" res = req.request_head(path) return URI(res["location"]).exists? if %w(301 302).include?(res.code) res.code == "200" end |