lib/httpx/response.rb in httpx-0.12.0 vs lib/httpx/response.rb in httpx-0.13.0
- old
+ new
@@ -25,12 +25,11 @@
@request = request
@options = request.options
@version = version
@status = Integer(status)
@headers = @options.headers_class.new(headers)
- @body = @options.response_body_class.new(self, threshold_size: @options.body_threshold_size,
- window_size: @options.window_size)
+ @body = @options.response_body_class.new(self, @options)
end
def merge_headers(h)
@headers = @headers.merge(h)
end
@@ -81,14 +80,15 @@
content_length == "0"
end
end
class Body
- def initialize(response, threshold_size:, window_size: 1 << 14)
+ def initialize(response, options)
@response = response
@headers = response.headers
- @threshold_size = threshold_size
- @window_size = window_size
+ @options = options
+ @threshold_size = options.body_threshold_size
+ @window_size = options.window_size
@encoding = response.content_type.charset || Encoding::BINARY
@length = 0
@buffer = nil
@state = :idle
end