Class: Async::HTTP::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/async/http/client.rb

Constant Summary collapse

GET =
'GET'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(endpoints, protocol_class = Protocol::HTTP11) ⇒ Client

Returns a new instance of Client.



28
29
30
31
32
# File 'lib/async/http/client.rb', line 28

def initialize(endpoints, protocol_class = Protocol::HTTP11)
	@endpoints = endpoints
	
	@protocol_class = protocol_class
end

Instance Method Details

#get(path, headers = {}) ⇒ Object



36
37
38
39
40
# File 'lib/async/http/client.rb', line 36

def get(path, headers = {})
	connect do |protocol|
		protocol.send_request(GET, path, headers)
	end
end