lib/async/http/protocol/http2/client.rb in async-http-0.44.0 vs lib/async/http/protocol/http2/client.rb in async-http-0.45.0
- old
+ new
@@ -36,10 +36,14 @@
framer = ::Protocol::HTTP2::Framer.new(@stream)
super(framer)
end
+ def create_response
+ Response.new(self, self.next_stream_id)
+ end
+
def stop_connection(error)
super
@streams.each do |id, stream|
if stream.respond_to?(:stop_connection)
@@ -52,13 +56,10 @@
def call(request)
raise ::Protocol::HTTP2::Error, "Connection closed!" if self.closed?
@count += 1
- stream_id = next_stream_id
- response = Response.new(self, stream_id)
- @streams[stream_id] = response.stream
-
+ response = create_response
response.send_request(request)
response.wait
return response
end