Class: URLCanonicalize::Request
- Inherits:
-
Object
- Object
- URLCanonicalize::Request
- Defined in:
- lib/url_canonicalize/request.rb
Overview
Make an HTTP request
Constant Summary collapse
- NETWORK_EXCEPTIONS =
[ EOFError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::EINVAL, Errno::ENETUNREACH, Errno::ETIMEDOUT, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError, SocketError, Timeout::Error, Zlib::BufError, Zlib::DataError ].freeze
- HEAD_FALLBACK_RESPONSES =
Unsuccessful responses to a HEAD request that trigger a retry with GET
[ Net::HTTPForbidden, Net::HTTPMethodNotAllowed, Net::HTTPNotImplemented ].freeze
Instance Method Summary collapse
- #fetch ⇒ Object
- #location ⇒ Object
-
#with_uri(uri) ⇒ Object
Point this request at a new URI, discarding all state from the previous response so nothing leaks between hops.
Instance Method Details
#fetch ⇒ Object
30 31 32 |
# File 'lib/url_canonicalize/request.rb', line 30 def fetch handle_response end |
#location ⇒ Object
34 35 36 |
# File 'lib/url_canonicalize/request.rb', line 34 def location @location ||= relative_to_absolute(response['location']) end |
#with_uri(uri) ⇒ Object
Point this request at a new URI, discarding all state from the previous response so nothing leaks between hops
40 41 42 43 44 45 46 47 |
# File 'lib/url_canonicalize/request.rb', line 40 def with_uri(uri) @uri = uri @url = nil self.http_method = @default_http_method self end |