Module: Azure::Core::HttpClient

Included in:
Storage::Client
Defined in:
lib/azure/storage/core/http_client.rb

Instance Method Summary collapse

Instance Method Details

#agents(uri) ⇒ Net::HTTP

Returns the http agent based on uri

Parameters:

  • uri (URI|String)

    the base uri (scheme, host, port) of the http endpoint

Returns:

  • (Net::HTTP)

    http agent for a given uri


21
22
23
24
25
26
27
28
29
# File 'lib/azure/storage/core/http_client.rb', line 21

def agents(uri)
  uri = URI.parse(uri) if uri.is_a?(String)
  key = uri.scheme.to_s + uri.host.to_s + uri.port.to_s
  @agents ||= {}
  unless @agents.key?(key)
    @agents[key] = build_http(uri)
  end
  @agents[key]
end

#reset_agents!Object

Empties all the http agents


32
33
34
# File 'lib/azure/storage/core/http_client.rb', line 32

def reset_agents!
  @agents = nil
end