Sha256: 1aa75e23b6fb62774888005e7410d8d4cdb02b7c237f06c39211dd4a678ef0a6

Contents?: true

Size: 472 Bytes

Versions: 8

Compression:

Stored size: 472 Bytes

Contents

require 'faraday_middleware/response_middleware'

module ZendeskAPI
  module Middleware
    module Response
      # Faraday middleware to handle content-encoding = gzip
      class Gzip < FaradayMiddleware::ResponseMiddleware
        define_parser do |body|
          Zlib::GzipReader.new(StringIO.new(body)).read
        end

        def parse_response?(env)
          super && env[:response_headers]['content-encoding'] == "gzip"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
zendesk_api-0.1.7 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.1.6 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.1.5 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.1.4 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.1.3 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.1.2 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.1.1 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-0.0.9 lib/zendesk_api/middleware/response/gzip.rb