Class: SenorArmando::Endpoint::Echo

Inherits:
Goliath::API
  • Object
show all
Defined in:
lib/senor_armando/endpoint/echo.rb

Instance Method Summary collapse

Instance Method Details

#on_headers(env, headers) ⇒ Object



6
7
8
# File 'lib/senor_armando/endpoint/echo.rb', line 6

def on_headers(env, headers)
  env['client-headers'] = headers
end

#response(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/senor_armando/endpoint/echo.rb', line 10

def response(env)
  headers = {
    "X-Echo-Params"  => env.params.to_json,
    "X-Echo-Path"    => env[Goliath::Request::REQUEST_PATH],
    "X-Echo-Headers" => env['client-headers'].to_json,
    "X-Echo-Method"  => env[Goliath::Request::REQUEST_METHOD]
  }
  [200, headers, "Hello from Responder\n"]
end