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

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/metatron/controllers/ping.rb', line 9

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