Sha256: 9ba8112ad99307c6d99a767cfab7d3e30009e9c2e6a45c2fb56b02b023e45d00
Contents?: true
Size: 843 Bytes
Versions: 2
Compression:
Stored size: 843 Bytes
Contents
module Webmention module Endpoint class Response HTTP_HEADERS_OPTS = { accept: '*/*', user_agent: 'Webmention Endpoint Discovery (https://rubygems.org/gems/webmention-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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webmention-endpoint-1.0.1 | lib/webmention/endpoint/response.rb |
webmention-endpoint-1.0.0 | lib/webmention/endpoint/response.rb |