Class: Metatron::Controllers::Ping

Inherits:
Object
  • Object
show all
Defined in:
lib/metatron/controllers/ping.rb

Overview

Healthcheck service

Constant Summary collapse

RESPONSE =
{ status: "up" }.to_json

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(env) ⇒ Object



10
# File 'lib/metatron/controllers/ping.rb', line 10

def call(env) = new.call(env)

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/metatron/controllers/ping.rb', line 13

def call(env)
  req = Rack::Request.new(env)

  return access_control_allow_methods if req.options?
  return [403, { Rack::CONTENT_TYPE => "application/json" }, []] unless req.get?

  Rack::Response[200, {
    "content-type" => "application/json",
    "x-frame-options" => "SAMEORIGIN",
    "x-xss-protection" => "1; mode=block"
  }, [RESPONSE]].to_a
end