lib/httpx/client.rb in httpx-0.0.3 vs lib/httpx/client.rb in httpx-0.0.4
- old
+ new
@@ -7,20 +7,22 @@
def initialize(options = {}, &blk)
@options = self.class.default_options.merge(options)
@connection = Connection.new(@options)
@responses = {}
+ @keep_open = false
wrap(&blk) if block_given?
end
def wrap
return unless block_given?
begin
+ prev_keep_open = @keep_open
@keep_open = true
yield self
ensure
- @keep_open = false
+ @keep_open = prev_keep_open
close
end
end
def close
@@ -41,10 +43,10 @@
def on_response(request, response)
@responses[request] = response
end
def on_promise(_, stream)
- log(2, "#{stream.id}: ") { "refusing stream!" }
+ log(level: 2, label: "#{stream.id}: ") { "refusing stream!" }
stream.refuse
# TODO: policy for handling promises
end
def fetch_response(request)