Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion google-cloud-storage/lib/google/cloud/storage/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def initialize project, credentials, retries: nil,
@service.request_options.header ||= {}
@service.request_options.header["x-goog-api-client"] =
"gl-ruby/#{RUBY_VERSION} gccl/#{Google::Cloud::Storage::VERSION}"
@service.request_options.header["Accept-Encoding"] = "gzip"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Removing the Accept-Encoding: gzip header globally from the service initialization will disable gzip compression for all API requests, including downloads. This may lead to a performance regression due to increased bandwidth usage for download operations. If the intent is to omit this header specifically for uploads, it should be handled at the individual request level rather than globally.

@service.request_options.quota_project = quota_project if quota_project
@service.request_options.max_elapsed_time = max_elapsed_time if max_elapsed_time
@service.request_options.base_interval = base_interval if base_interval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def creds.is_a? target
_(project.universe_domain).must_equal "googleapis.com"
end

it "does not set Accept-Encoding gzip header by default" do
service = Google::Cloud::Storage::Service.new "my-project", default_credentials
_(service.service.request_options.header["Accept-Encoding"]).must_be :nil?
end

it "supports setting a universe domain argument" do
service = Google::Cloud::Storage::Service.new "my-project", default_credentials, universe_domain: "mydomain1.com"
_(service.universe_domain).must_equal "mydomain1.com"
Expand Down