Class: Charcoal::CrossOriginController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
AbstractController::Callbacks, ActionController::Head, ActionController::Instrumentation, CrossOrigin, Utilities
Defined in:
lib/charcoal/cross_origin_controller.rb

Constant Summary

Constants included from Utilities

Utilities::Routing

Instance Method Summary collapse

Methods included from Utilities

#allowed_methods_for?

Methods included from CrossOrigin

included

Instance Method Details

#preflightObject

OPTIONS *



23
24
25
26
27
28
29
30
31
32
# File 'lib/charcoal/cross_origin_controller.rb', line 23

def preflight
  if allowed_methods.any?
    set_cors_headers
    headers["Access-Control-Allow-Methods"] = allowed_methods.join(",").upcase
    headers["Access-Control-Max-Age"] = Charcoal.configuration["max-age"].to_s
    headers["Access-Control-Allow-Headers"] = Charcoal.configuration["allow-headers"].join(",")
  end

  head :ok, content_type: "text/plain"
end