From b6111df6d17704f077495597b066e9df099be918 Mon Sep 17 00:00:00 2001 From: Doug Hughes Date: Sat, 25 Mar 2023 10:05:52 -0400 Subject: [PATCH] Add support for gzip decompressing in Ruby gem This commit sets the middleware used by Excon connections to include the defaults and Excon::Middleware::Decompress, which decompresses gzip data returned from the Mailchimp API. --- .../marketing/ruby/templates/api_client.mustache | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swagger-config/marketing/ruby/templates/api_client.mustache b/swagger-config/marketing/ruby/templates/api_client.mustache index 4555e1f..55ff9ff 100644 --- a/swagger-config/marketing/ruby/templates/api_client.mustache +++ b/swagger-config/marketing/ruby/templates/api_client.mustache @@ -57,7 +57,12 @@ module {{moduleName}} headers[:Authorization] = "Bearer #@access_token" if @is_oauth host = @server.length > 0 ? @host.sub('server', @server) : @host - conn = Excon.new(host + path, :headers => headers, :read_timeout => @read_timeout, :write_timeout => @write_timeout, :connect_timeout => @connect_timeout) + conn = Excon.new(host + path, + :headers => headers, + :read_timeout => @read_timeout, + :write_timeout => @write_timeout, + :connect_timeout => @connect_timeout, + :middlewares => [Excon.defaults[:middlewares], Excon::Middleware::Decompress].flatten) res = nil case http_method.to_sym.downcase