class Async::HTTP::Internet
def call(method, url, headers = [], body = nil)
def call(method, url, headers = [], body = nil) endpoint = URLEndpoint.parse(url) client = @clients.fetch(endpoint) do @clients[endpoint] = Client.new(endpoint) end body = Body::Buffered.wrap(body) request = Request.new(endpoint.authority, method, endpoint.path, nil, headers, body) return client.call(request) end
def close
def close @clients.each_value(&:close) @clients.clear end
def initialize
def initialize @clients = {} end