summaryrefslogtreecommitdiff
path: root/test/net/http
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-10 10:53:18 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-10 10:53:18 +0000
commitccf911a02d35bf1d1667149d94b16da429049eee (patch)
tree61a7963b5190f00e8db28cc1236ee552cf8e0d34 /test/net/http
parent89c88eb5a9318f763779968e4c80214319ecb870 (diff)
Refix r36678: switch with zlib and check content-encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http')
-rw-r--r--test/net/http/test_httpresponse.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb
index c201410598..70313cc519 100644
--- a/test/net/http/test_httpresponse.rb
+++ b/test/net/http/test_httpresponse.rb
@@ -92,8 +92,14 @@ EOS
body = res.read_body
end
- assert_equal 'hello', body
- end if Net::HTTP::HAVE_ZLIB
+ if Net::HTTP::HAVE_ZLIB
+ assert_equal nil, res['content-encoding']
+ assert_equal 'hello', body
+ else
+ assert_equal 'deflate', res['content-encoding']
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body
+ end
+ end
def test_read_body_content_encoding_deflate_chunked
io = dummy_io(<<EOS)
@@ -118,8 +124,14 @@ EOS
body = res.read_body
end
- assert_equal 'hello', body
- end if Net::HTTP::HAVE_ZLIB
+ if Net::HTTP::HAVE_ZLIB
+ assert_equal nil, res['content-encoding']
+ assert_equal 'hello', body
+ else
+ assert_equal 'deflate', res['content-encoding']
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15", body
+ end
+ end
def test_read_body_content_encoding_deflate_no_length
io = dummy_io(<<EOS)
@@ -138,8 +150,14 @@ EOS
body = res.read_body
end
- assert_equal 'hello', body
- end if Net::HTTP::HAVE_ZLIB
+ if Net::HTTP::HAVE_ZLIB
+ assert_equal nil, res['content-encoding']
+ assert_equal 'hello', body
+ else
+ assert_equal 'deflate', res['content-encoding']
+ assert_equal "x\x9C\xCBH\xCD\xC9\xC9\a\x00\x06,\x02\x15\r\n", body
+ end
+ end
def test_read_body_content_encoding_deflate_content_range
io = dummy_io(<<EOS)