Module: HTTPX::Plugins::Compression::RequestBodyMethods

Defined in:
lib/httpx/plugins/compression.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject


27
28
29
30
31
32
33
34
35
# File 'lib/httpx/plugins/compression.rb', line 27

def initialize(*)
  super
  return if @body.nil?

  @headers.get("content-encoding").each do |encoding|
    @body = Encoder.new(@body, Compression.registry(encoding).encoder)
  end
  @headers["content-length"] = @body.bytesize unless chunked?
end