Merge pull request #637 from bantini/636-disable-gzip

feat: Allow disabling of the gzip decompression using client_options
This commit is contained in:
Nilayan Bhattacharya 2017-11-29 17:42:12 -05:00 committed by GitHub
commit b35f5face3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -400,7 +400,10 @@ module Google
def new_client
client = ::HTTPClient.new
client.transparent_gzip_decompression = true
if client_options.transparent_gzip_decompression
client.transparent_gzip_decompression = client_options.transparent_gzip_decompression
end
client.proxy = client_options.proxy_url if client_options.proxy_url
if client_options.open_timeout_sec

View File

@ -22,7 +22,8 @@ module Google
:open_timeout_sec,
:read_timeout_sec,
:send_timeout_sec,
:log_http_requests)
:log_http_requests,
:transparent_gzip_decompression)
RequestOptions = Struct.new(
:authorization,
@ -47,6 +48,8 @@ module Google
# @return [Fixnum] How long, in seconds, before failed connections time out
# @!attribute [rw] read_timeout_sec
# @return [Fixnum] How long, in seconds, before requests time out
# @!attribute [rw] transparent_gzip_decompression
# @return [Boolean] True if gzip compression needs to be enabled
# Get the default options
# @return [Google::Apis::ClientOptions]
def self.default
@ -92,6 +95,7 @@ module Google
ClientOptions.default.log_http_requests = false
ClientOptions.default.application_name = 'unknown'
ClientOptions.default.application_version = '0.0.0'
ClientOptions.default.transparent_gzip_decompression = true
RequestOptions.default.retries = 0
RequestOptions.default.normalize_unicode = false
RequestOptions.default.skip_serialization = false