diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-12 22:15:31 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-12 22:15:31 +0000 |
commit | 6ef323d6f8a4cb768ce8217171487d8932bc7bd8 (patch) | |
tree | a810a5ed89d355cf557d2772c57bc5e558d8eeca /test | |
parent | 0f9662f3660bd98a0a31196b4bef82aa78b0529c (diff) | |
download | ruby-6ef323d6f8a4cb768ce8217171487d8932bc7bd8.tar.gz |
* 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')
-rw-r--r-- | test/webrick/test_httpresponse.rb | 46 |
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 0000000000..3967e2c3e8 --- /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 |