grape-cors
Ruby Grape Api extension with Cross-origin resource sharing
Example:
class API < Grape::API
get :info do
end
end
Grape::CORS.apply!
In case if you need to use the 'options' call, you should use by hand the following method:
- init_cors_headers!
because the apply method will not override the options enpoints (safety reasons)
And otherwise, that option call will lack the required headers
if you want change any of the cors object, you can do so in the following way:
Grape::CORS::Config.headers
Grape::CORS::Config.origin
Grape::CORS::Config.methods
Grape::CORS::Config.acah
Grape::CORS::Config.acao
Grape::CORS::Config.acam
Grape::CORS::Config.origin.clear
Grape::CORS::Config.origin.push(some_origin_site)
Happy coding! :)