lib/url_status.rb in url-status-1.0.7 vs lib/url_status.rb in url-status-1.1.0

- old
+ new

@@ -45,11 +45,11 @@ end def url_list opts = Trollop::options do version "url-status #{UrlStatus::VERSION} (c) 2016 @reednj (reednj@gmail.com)" - banner "Usage: #{$0} [options] [urls...]" + banner "Usage: url-status [options] [urls...]" opt :config, "YAML config file containing array of urls", :type => :string end if ARGV.empty? @@ -73,13 +73,14 @@ def default_config_file "#{ENV['HOME']}/sites.yaml" end def get_response(url) + user_agent = "url-status/#{UrlStatus::VERSION}" url = 'http://' + url unless url.start_with? 'http' begin - return RestClient.get(url) + return RestClient.get(url, :user_agent => user_agent) rescue RestClient::ExceptionWithResponse => e raise e if e.response.nil? return e.response end end