Class: AccessControl::Middleware
- Inherits:
-
Object
- Object
- AccessControl::Middleware
- Defined in:
- lib/access_control.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
3 4 5 |
# File 'lib/access_control.rb', line 3 def initialize app @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/access_control.rb', line 7 def call env res = @app.call(env) res[1]["Access-Control-Allow-Origin"] = "*" res[1]["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS" res[1]["Access-Control-Allow-Headers"] = "X-PINGOTHER " res end |