summaryrefslogtreecommitdiff
path: root/test/webrick/test_httpresponse.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-12 22:15:31 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-12 22:15:31 +0000
commit6ef323d6f8a4cb768ce8217171487d8932bc7bd8 (patch)
treea810a5ed89d355cf557d2772c57bc5e558d8eeca /test/webrick/test_httpresponse.rb
parent0f9662f3660bd98a0a31196b4bef82aa78b0529c (diff)
* lib/webrick/httpresponse.rb (setup_header): 204 and 304 responses
are allowed to have a Keep-Alive connection. [ruby-core:41581] * test/webrick/test_httpresponse.rb: corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/test_httpresponse.rb')
-rw-r--r--test/webrick/test_httpresponse.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/webrick/test_httpresponse.rb b/test/webrick/test_httpresponse.rb
new file mode 100644
index 0000000..3967e2c
--- /dev/null
+++ b/test/webrick/test_httpresponse.rb
@@ -0,0 +1,46 @@
+require "webrick"
+require "minitest/autorun"
+
+module WEBrick
+ class TestHTTPResponse < MiniTest::Unit::TestCase
+ class FakeLogger
+ attr_reader :messages
+
+ def initialize
+ @messages = []
+ end
+
+ def warn msg
+ @messages << msg
+ end
+ end
+
+ def test_304_does_not_log_warning
+ logger = FakeLogger.new
+ config = Config::HTTP
+ config[:Logger] = logger
+
+ res = HTTPResponse.new config
+ res.status = 304
+ res.keep_alive = true
+
+ res.setup_header
+
+ assert_equal 0, logger.messages.length
+ end
+
+ def test_204_does_not_log_warning
+ logger = FakeLogger.new
+ config = Config::HTTP
+ config[:Logger] = logger
+
+ res = HTTPResponse.new config
+ res.status = 204
+ res.keep_alive = true
+
+ res.setup_header
+
+ assert_equal 0, logger.messages.length
+ end
+ end
+end