URI Response Code URI Response Code ruby ruby

URI Response Code


You can use the status method to return an array that contains the status code and message.

require "open-uri" open("http://www.example.org") do |f|  puts f.base_uri  #=> http://www.example.org  puts f.status    #=> ["200", "OK"]end