diff options
-rw-r--r-- | lib/puppet/network/http/compression.rb | 6 | ||||
-rwxr-xr-x | spec/unit/network/http/compression_spec.rb | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb index 6e8314b72..839fe40b2 100644 --- a/lib/puppet/network/http/compression.rb +++ b/lib/puppet/network/http/compression.rb @@ -46,7 +46,11 @@ module Puppet::Network::HTTP::Compression end def add_accept_encoding(headers={}) - headers['accept-encoding'] = 'gzip; q=1.0, deflate; q=1.0; identity' if Puppet.settings[:http_compression] + if Puppet.settings[:http_compression] + headers['accept-encoding'] = 'gzip; q=1.0, deflate; q=1.0; identity' + else + headers['accept-encoding'] = 'identity' + end headers end diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb index 9dbf4228c..9fa37dd01 100755 --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -61,9 +61,9 @@ describe "http compression" do headers['accept-encoding'].should =~ /identity/ end - it "should not add Accept-Encoding header if http compression is not available" do + it "should add an Accept-Encoding 'identity' header if http compression is disabled" do Puppet[:http_compression] = false - @uncompressor.add_accept_encoding({}).should == {} + @uncompressor.add_accept_encoding({}).should == {'accept-encoding' => 'identity'} end describe "when uncompressing response body" do |