module SnipSnap::CORSExtension
Require Path: `snipsnap/extensions/cors`
Public Class Methods
registered(app)
click to toggle source
# File lib/snipsnap/extensions/cors.rb, line 6 def self.registered(app) app.before do # CORS HEADERS headers \ "Access-Control-Allow-Origin" => "*", "Access-Control-Allow-Methods" => "POST, GET, PUT, DELETE, OPTIONS", "Access-Control-Allow-Credentials" => "true" # Handle HTTP OPTIONS method used by jQuery if request.request_method == 'OPTIONS' headers["Access-Control-Allow-Headers"] = "Origin, Content-type, Accept, Authorization" halt 200 end end end