Permalink
Browse files

allow for alternate locations for status app

  • Loading branch information...
1 parent 08ae68f commit a2a53316c3c747db31c6ccd85b461503f139220f Paco Viromontes committed Oct 4, 2012
Showing with 9 additions and 5 deletions.
  1. +4 −4 lib/puma/app/status.rb
  2. +5 −1 test/test_app_status.rb
View
@@ -21,15 +21,15 @@ def call(env)
end
case env['PATH_INFO']
- when "/stop"
+ when /\/stop$/
@server.stop
return rack_response(200, OK_STATUS)
- when "/halt"
+ when /\/halt$/
@server.halt
return rack_response(200, OK_STATUS)
- when "/restart"
+ when /\/restart$/
if @cli and @cli.restart_on_stop!
@server.begin_restart
@@ -38,7 +38,7 @@ def call(env)
return rack_response(200, '{ "status": "not configured" }')
end
- when "/stats"
+ when /\/stats$/
b = @server.backlog
r = @server.running
return rack_response(200, %Q!{ "backlog": #{b}, "running": #{r} }!)
View
@@ -75,10 +75,14 @@ def test_halt
def test_stats
@server.backlog = 1
@server.running = 9
-
status, _ , app = lint('/stats')
assert_equal 200, status
assert_equal ['{ "backlog": 1, "running": 9 }'], app.enum_for.to_a
end
+
+ def test_alternate_location
+ status, _ , app = lint('__alternatE_location_/stats')
+ assert_equal 200, status
+ end
end

0 comments on commit a2a5331

Please sign in to comment.