Sha256: 1d61cd06a3486c2fb00550aa496fdaf88728ed40d2f06204742cd514a8a6715a

Contents?: true

Size: 721 Bytes

Versions: 3

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module HTTP
  module Features
    class AutoInflate < Feature
      def wrap_response(response)
        return response unless %w[deflate gzip x-gzip].include?(response.headers[:content_encoding])
        Response.new(
          :status => response.status,
          :version => response.version,
          :headers => response.headers,
          :proxy_headers => response.proxy_headers,
          :connection => response.connection,
          :body => stream_for(response.connection)
        )
      end

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

      HTTP::Options.register_feature(:auto_inflate, self)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
http-4.0.2 lib/http/features/auto_inflate.rb
http-4.0.1 lib/http/features/auto_inflate.rb
http-4.0.0 lib/http/features/auto_inflate.rb