Class: ZendeskAPI::Middleware::Response::Deflate

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/zendesk_api/middleware/response/deflate.rb

Overview

Faraday middleware to handle content-encoding = inflate

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object


9
10
11
12
13
# File 'lib/zendesk_api/middleware/response/deflate.rb', line 9

def on_complete(env)
  if !env.body.strip.empty? && env[:response_headers]['content-encoding'] == "deflate"
    env.body = Zlib::Inflate.inflate(env.body)
  end
end