lib/zendesk_api/middleware/response/gzip.rb in zendesk_api-1.4.0 vs lib/zendesk_api/middleware/response/gzip.rb in zendesk_api-1.4.2

- old
+ new

@@ -7,10 +7,10 @@ # @private module Response # Faraday middleware to handle content-encoding = gzip class Gzip < Faraday::Response::Middleware def on_complete(env) - if env[:body].respond_to?(:to_str) && !env[:body].strip.empty? && env[:response_headers]['content-encoding'] == "gzip" + 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