Module: Rack::Httperflog::UrlHelper

Extended by:
UrlHelper
Included in:
UrlHelper
Defined in:
lib/rack/httperflog.rb

Instance Method Summary collapse

Instance Method Details

#url_status_is?(status, host, port, path) ⇒ Boolean

Checks if the status code returned by a GET to host:port/path is the one provided in the first param.

Returns:

  • (Boolean)


119
120
121
# File 'lib/rack/httperflog.rb', line 119

def url_status_is?(status, host, port, path)
  Net::HTTP.start(host, port) {|http| http.get(path) }.code.to_s.strip == status.to_s rescue false
end