class Charcoal::CrossOriginController

Public Instance Methods

preflight() click to toggle source

OPTIONS *

# 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

Private Instance Methods

allowed_methods() click to toggle source
# File lib/charcoal/cross_origin_controller.rb, line 36
def allowed_methods
  allowed_methods_for?(:cors)
end