Class: TentD::API::CorsPreflight

Inherits:
Middleware show all
Defined in:
lib/tentd/api.rb

Instance Method Summary collapse

Methods inherited from Middleware

#call, #initialize

Methods included from Authorizable

#authorize_env!, #authorize_env?

Constructor Details

This class inherits a constructor from TentD::API::Middleware

Instance Method Details

#action(env) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/tentd/api.rb', line 39

def action(env)
  headers = {
    'Access-Control-Allow-Origin' => '*',
    'Access-Control-Allow-Methods' => 'GET, POST, HEAD, PUT, DELETE, PATCH, OPTIONS',
    'Access-Control-Allow-Headers' => 'Authorization',
    'Access-Control-Max-Age' => '2592000' # 30 days
  }
  [200, headers, []]
end