From 41e3dcf47d8ee855747681b80dab1c3b9d6bc457 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 2 Sep 2009 18:21:09 -0700 Subject: expose the $content_length/$content_type variables Since the HTTP_CONTENT_LENGTH and HTTP_CONTENT_TYPE variables are not allowed by Rack, we need to allow access to the CGI variables instead. --- test/test_clogger.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 5b81125..4dc1371 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -410,4 +410,20 @@ class TestClogger < Test::Unit::TestCase assert_equal "GET\n", str.string end + def test_content_length_null + str = StringIO.new + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => str, :format => '$content_length') + cl.call(@req) + assert_equal "-\n", str.string + end + + def test_content_length_set + str = StringIO.new + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => str, :format => '$content_length') + cl.call(@req.merge('CONTENT_LENGTH' => '5')) + assert_equal "5\n", str.string + end + end -- cgit v1.2.3-24-ge0c7