Module: HTTPX::Transcoder::Deflate

Defined in:
lib/httpx/transcoder/deflate.rb

Defined Under Namespace

Classes: Deflater

Class Method Summary collapse

Class Method Details

.decode(response, bytesize: nil) ⇒ Object



31
32
33
34
# File 'lib/httpx/transcoder/deflate.rb', line 31

def decode(response, bytesize: nil)
  bytesize ||= response.headers.key?("content-length") ? response.headers["content-length"].to_i : Float::INFINITY
  GZIP::Inflater.new(bytesize)
end

.encode(body) ⇒ Object



27
28
29
# File 'lib/httpx/transcoder/deflate.rb', line 27

def encode(body)
  Deflater.new(body)
end