Sha256: fe45349282fcc162b4ad2345791719d0434ec7935bc67d4e6fe754450c024d13
Contents?: true
Size: 837 Bytes
Versions: 5
Compression:
Stored size: 837 Bytes
Contents
module Micropub module Endpoint class Response HTTP_HEADERS_OPTS = { accept: '*/*', user_agent: 'Micropub Endpoint Discovery (https://rubygems.org/gems/micropub-endpoint)' }.freeze def initialize(uri) raise ArgumentError, "uri must be an Addressable::URI (given #{uri.class.name})" unless uri.is_a?(Addressable::URI) @uri = uri end def response @response ||= HTTP.follow.headers(HTTP_HEADERS_OPTS).timeout( connect: 10, read: 10 ).get(@uri) rescue HTTP::ConnectionError => error raise ConnectionError, error rescue HTTP::TimeoutError => error raise TimeoutError, error rescue HTTP::Redirector::TooManyRedirectsError => error raise TooManyRedirectsError, error end end end end
Version data entries
5 entries across 5 versions & 1 rubygems