Class: Adsf::Rack::CORS
- Inherits:
-
Object
- Object
- Adsf::Rack::CORS
- Defined in:
- lib/adsf/rack/cors.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ CORS
constructor
A new instance of CORS.
Constructor Details
#initialize(app) ⇒ CORS
Returns a new instance of CORS.
5 6 7 |
# File 'lib/adsf/rack/cors.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/adsf/rack/cors.rb', line 9 def call(env) status, headers, body = *@app.call(env) new_headers = headers.merge( 'access-control-allow-origin' => '*', 'access-control-allow-headers' => 'Origin, X-Requested-With, Content-Type, Accept, Range', ) [status, new_headers, body] end |