Class: HTTP::Features::AutoInflate

Inherits:
HTTP::Feature show all
Defined in:
lib/http/features/auto_inflate.rb

Instance Method Summary collapse

Methods inherited from HTTP::Feature

#initialize, #wrap_request

Constructor Details

This class inherits a constructor from HTTP::Feature

Instance Method Details

#stream_for(connection) ⇒ Object



28
29
30
# File 'lib/http/features/auto_inflate.rb', line 28

def stream_for(connection)
  Response::Body.new(Response::Inflater.new(connection))
end

#wrap_response(response) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/http/features/auto_inflate.rb', line 11

def wrap_response(response)
  return response unless supported_encoding?(response)

  options = {
    :status => response.status,
    :version => response.version,
    :headers => response.headers,
    :proxy_headers => response.proxy_headers,
    :connection => response.connection,
    :body => stream_for(response.connection)
  }

  options[:uri] = response.uri if response.uri

  Response.new(options)
end