Module: Async::HTTP::Proxy::Client

Included in:
Client
Defined in:
lib/async/http/proxy.rb

Overview

Extends Client with proxy capabilities.

Instance Method Summary collapse

Instance Method Details

#proxied_client(endpoint, headers = nil) ⇒ Object

Create a client that will proxy requests through the current client.



39
40
41
42
43
# File 'lib/async/http/proxy.rb', line 39

def proxied_client(endpoint, headers = nil)
	proxy = self.proxy(endpoint, headers)
	
	return self.class.new(proxy.wrap_endpoint(endpoint))
end

#proxied_endpoint(endpoint, headers = nil) ⇒ Object

Create an endpoint that connects via this proxy.



49
50
51
52
53
# File 'lib/async/http/proxy.rb', line 49

def proxied_endpoint(endpoint, headers = nil)
	proxy = self.proxy(endpoint, headers)
	
	return proxy.wrap_endpoint(endpoint)
end

#proxy(endpoint, headers = nil) ⇒ Object

Create a proxy instance for the given endpoint.



34
35
36
# File 'lib/async/http/proxy.rb', line 34

def proxy(endpoint, headers = nil)
	Proxy.new(self, endpoint.authority(false), headers)
end