Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for gzip decompressing in Ruby gem #325

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion swagger-config/marketing/ruby/templates/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the magic line. It sets the middlewares used by the new Excon connection to be the defaults (Excon.defaults[:middlewares]) and Excon::Middleware::Decompress, which knows how to decompress gzip response data.


res = nil
case http_method.to_sym.downcase
Expand Down