lib/httpx/plugins/compression.rb in httpx-0.13.2 vs lib/httpx/plugins/compression.rb in httpx-0.14.0
- old
+ new
@@ -23,22 +23,22 @@
encodings = Module.new do
extend Registry
end
Class.new(options.class) do
- def_option(:compression_threshold_size) do |bytes|
- bytes = Integer(bytes)
+ def_option(:compression_threshold_size, <<-OUT)
+ bytes = Integer(value)
raise Error, ":expect_threshold_size must be positive" unless bytes.positive?
bytes
- end
+ OUT
- def_option(:encodings) do |encs|
- raise Error, ":encodings must be a registry" unless encs.respond_to?(:registry)
+ def_option(:encodings, <<-OUT)
+ raise Error, ":encodings must be a registry" unless value.respond_to?(:registry)
- encs
- end
+ value
+ OUT
end.new(options).merge(encodings: encodings)
end
end
module RequestMethods
@@ -64,10 +64,10 @@
@headers.get("content-encoding").each do |encoding|
next if encoding == "identity"
@body = Encoder.new(@body, options.encodings.registry(encoding).deflater)
end
- @headers["content-length"] = @body.bytesize unless chunked?
+ @headers["content-length"] = @body.bytesize unless unbounded_body?
end
end
module ResponseBodyMethods
attr_reader :encodings