Method: Chassis::Rack::Ping#call
- Defined in:
- lib/chassis/rack/health_check.rb
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/chassis/rack/health_check.rb', line 10 def call(env) if '/ping' == env.fetch('PATH_INFO') if @block begin result = @block.call(::Rack::Request.new(env)) raise "health check did not return correctly" unless result rescue => boom raise HealthCheckError, boom.to_s end end [200, {'Content-Type' => 'text/plain'}, ['pong']] else @app.call env end end |