[前][次][番号順一覧][スレッド一覧]

ruby-changes:24629

From: naruse <ko1@a...>
Date: Fri, 10 Aug 2012 19:53:28 +0900 (JST)
Subject: [ruby-changes:24629] naruse:r36680 (trunk): Refix r36678: switch with zlib and check content-encoding.

naruse	2012-08-10 19:53:18 +0900 (Fri, 10 Aug 2012)

  New Revision: 36680

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36680

  Log:
    Refix r36678: switch with zlib and check content-encoding.

  Modified files:
    trunk/test/net/http/test_httpresponse.rb

Index: test/net/http/test_httpresponse.rb
===================================================================
--- test/net/http/test_httpresponse.rb	(revision 36679)
+++ test/net/http/test_httpresponse.rb	(revision 36680)
@@ -92,8 +92,14 @@
       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 @@
       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 @@
       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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]