summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppetlabs.com>2014-09-08 13:23:09 -0700
committerJosh Cooper <josh@puppetlabs.com>2014-09-08 14:01:02 -0700
commit636adc0444757dd33a21787ddc40378b39e0b1dd (patch)
treef5382d92411f4f60f84da8e62fba9b1b7c366e89
parent2663d7fb0ccc207ee9c83b756c88d3863ff850e1 (diff)
parentc606c647aa44965a178556dab262426b98b8127d (diff)
downloadpuppet-636adc0444757dd33a21787ddc40378b39e0b1dd.tar.gz
Merge remote-tracking branch 'upstream/pr/3057' into stable
* upstream/pr/3057: correct test description for http_compression disabled (PUP-1680) Set accept-encoding to identity when http_compression is false Closes GH-3057
-rw-r--r--lib/puppet/network/http/compression.rb6
-rwxr-xr-xspec/unit/network/http/compression_spec.rb4
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