Class: Rails::Hyperdrive::CompanionDiscovery::NetHttpFetcher
- Inherits:
-
Object
- Object
- Rails::Hyperdrive::CompanionDiscovery::NetHttpFetcher
- Defined in:
- lib/rails/hyperdrive/companion_discovery.rb
Instance Method Summary collapse
Instance Method Details
#get(uri) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/rails/hyperdrive/companion_discovery.rb', line 52 def get(uri) uri = URI(uri) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == "https" http.open_timeout = OPEN_TIMEOUT http.read_timeout = READ_TIMEOUT resp = http.get(uri.request_uri) Response.new(code: resp.code.to_i, body: resp.body.to_s, retry_after: resp["retry-after"]) end |