55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/httpx/plugins/compression.rb', line 55
def initialize(*, options)
super
return if @body.nil?
threshold = options.compression_threshold_size
return if threshold && !unbounded_body? && @body.bytesize < threshold
@headers.get("content-encoding").each do |encoding|
next if encoding == "identity"
next unless options.encodings.key?(encoding)
@body = Encoder.new(@body, options.encodings[encoding].deflater)
end
@headers["content-length"] = @body.bytesize unless unbounded_body?
end
|