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.37.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.36.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.35.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.34.0 lib/zendesk_api/middleware/response/gzip.rb
discourse_zendesk_api-1.0.1 lib/zendesk_api/middleware/response/gzip.rb
discourse_zendesk_api-1.0.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.33.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.32.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.31.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.30.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.29.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.28.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.27.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.26.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.25.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.24.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.23.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.22.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.21.0 lib/zendesk_api/middleware/response/gzip.rb
zendesk_api-1.20.0 lib/zendesk_api/middleware/response/gzip.rb