Sha256: 2754e63c5c928c2ab3fd9a80fe7132160f3b053519a46de2e8e0172d92703a31

Contents?: true

Size: 485 Bytes

Versions: 68

Compression:

Stored size: 485 Bytes

Contents

require 'zlib'
require 'stringio'

module ZendeskAPI
  # @private
  module Middleware
    # @private
    module Response
      # Faraday middleware to handle content-encoding = gzip
      class Gzip < Faraday::Response::Middleware
        def on_complete(env)
          if !env[:body].strip.empty? && env[:response_headers]['content-encoding'] == "gzip"
            env[:body] = Zlib::GzipReader.new(StringIO.new(env[:body])).read
          end
        end
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
zendesk_api-1.6.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.5.1 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.5.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.4.6 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.4.5 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.4.4 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.4.3 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.4.2 lib/zendesk_api/middleware/response/gzip.rb