summaryrefslogtreecommitdiff
path: root/test/net/http/test_http_request.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 01:08:19 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 01:08:19 +0000
commitf58d39807541d8f50ba682183ab9097ddcb52698 (patch)
treee2f20a5100c5f69f94827d9730b0dff597011493 /test/net/http/test_http_request.rb
parentd266423f8709cb121630cb6e3f403736dbf8ff25 (diff)
* lib/net/http: Do not handle Content-Encoding when the user sets
Accept-Encoding. This allows users to handle Content-Encoding for themselves. This restores backwards-compatibility with Ruby 1.x. * lib/net/http/generic_request.rb: ditto. * lib/net/http/response.rb: ditto * test/net/http/test_http.rb: Test for the above. * test/net/http/test_http_request.rb: ditto. * test/net/http/test_httpresponse.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http/test_http_request.rb')
-rw-r--r--test/net/http/test_http_request.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/net/http/test_http_request.rb b/test/net/http/test_http_request.rb
index c01e52c0b4..4ce93acde3 100644
--- a/test/net/http/test_http_request.rb
+++ b/test/net/http/test_http_request.rb
@@ -53,5 +53,27 @@ class HTTPRequestTest < Test::Unit::TestCase
assert_equal expected, req.to_hash
end
+ def test_initialize_accept_encoding
+ req1 = Net::HTTP::Get.new '/'
+
+ assert req1.decode_content, 'Bug #7831 - automatically decode content'
+
+ req2 = Net::HTTP::Get.new '/', 'accept-encoding' => 'identity'
+
+ refute req2.decode_content,
+ 'Bug #7381 - do not decode content if the user overrides'
+ end
+
+ def test_header_set
+ req = Net::HTTP::Get.new '/'
+
+ assert req.decode_content, 'Bug #7831 - automatically decode content'
+
+ req['accept-encoding'] = 'identity'
+
+ refute req.decode_content,
+ 'Bug #7831 - do not decode content if the user overrides'
+ end
+
end