diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-09-02 18:15:27 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-09-02 18:15:27 -0700 |
commit | 34bda71752bc7401c552a7a4d5b77cf7e1bfe431 (patch) | |
tree | 098637bd23ac84f95c2e9440da2be65d76ebdcb5 | |
parent | d60d0b4656718a63137f89baa15b6589740ad454 (diff) | |
download | clogger-34bda71752bc7401c552a7a4d5b77cf7e1bfe431.tar.gz |
Accessing "REQUEST_METHOD" in the Rack env should be doable as a CGI-ish variable. Thanks to IƱaki Baz Castillo for spotting the issue and reporting it to me.
-rw-r--r-- | lib/clogger.rb | 3 | ||||
-rw-r--r-- | test/test_clogger.rb | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/clogger.rb b/lib/clogger.rb index 9a76f38..8538048 100644 --- a/lib/clogger.rb +++ b/lib/clogger.rb @@ -35,7 +35,8 @@ class Clogger private CGI_ENV = Regexp.new('\A\$(' << - %w(remote_addr remote_ident remote_user + %w(request_method + remote_addr remote_ident remote_user path_info query_string script_name server_name server_port).join('|') << ')\z').freeze diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 9fd6d05..5b81125 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -402,4 +402,12 @@ class TestClogger < Test::Unit::TestCase assert_equal "GET /hello?goodbye=true\n", str.string end + def test_request_method_only + str = StringIO.new + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => str, :format => '$request_method') + cl.call(@req) + assert_equal "GET\n", str.string + end + end |