Sha256: a39f91d1534b71b1ffcf5b6e8cbfd337228a3b697ea07bd12d91499a2201b26d
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
module LinkChecker module Net module HTTP class Result < ::LinkChecker::Result attr_accessor :request, :response def initialize(uri, method, original_uri, request, response, options) @request = request @response = response super uri, method, original_uri, options end def error? false end def failure? !success? && !redirect? end def code @code ||= begin response.code.to_i rescue StandardError -1 end end def request_headers request end def redirect_to return nil unless response response['Location'] end def redirect? return false unless response [301, 302, 303, 307, 308].include?(code) end def success? return false unless response code >= 200 && code <= 299 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-link-checker-0.2.0 | lib/ruby-link-checker/net/http/result.rb |
ruby-link-checker-0.1.0 | lib/ruby-link-checker/net/http/result.rb |