class EurekaRuby::Middleware

Public Class Methods

new(app) click to toggle source
# File lib/eureka_ruby/middleware.rb, line 5
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/eureka_ruby/middleware.rb, line 9
def call(env)
  if env['PATH_INFO'] == health_path
    NewRelic::Agent.ignore_transaction if defined? NewRelic
    [200, health_headers, [health_response]]
  elsif env['PATH_INFO'] == info_path
    NewRelic::Agent.ignore_transaction if defined? NewRelic
    [200, { 'Content-Type' => 'application/json' }, [info_response.to_json]]
  else
    @app.call(env)
  end
end