lib/httpx/plugins/compression/brotli.rb in httpx-0.13.2 vs lib/httpx/plugins/compression/brotli.rb in httpx-0.14.0

- old
+ new

@@ -3,28 +3,29 @@ module HTTPX module Plugins module Compression module Brotli class << self - def load_dependencies(klass) - klass.plugin(:compression) + def load_dependencies(_klass) require "brotli" end def configure(klass) + klass.plugin(:compression) klass.default_options.encodings.register "br", self end end module Deflater module_function - def deflate(raw, buffer, chunk_size:) + def deflate(raw, buffer = "".b, chunk_size: 16_384) while (chunk = raw.read(chunk_size)) compressed = ::Brotli.deflate(chunk) buffer << compressed yield compressed if block_given? end + buffer end end class Inflater def initialize(bytesize)