class HTTP::Features::AutoInflate
Constants
- SUPPORTED_ENCODING
Public Instance Methods
Source
# File lib/http/features/auto_inflate.rb, line 27 def stream_for(connection) Response::Body.new(Response::Inflater.new(connection)) end
Source
# 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), :request => response.request } Response.new(options) end
Private Instance Methods
Source
# File lib/http/features/auto_inflate.rb, line 33 def supported_encoding?(response) content_encoding = response.headers.get(Headers::CONTENT_ENCODING).first content_encoding && SUPPORTED_ENCODING.include?(content_encoding) end