Sha256: b4967d744dfd1bd7aebde0a4a35fe1a82b4358cc6140a8a5993daac4d4f0a743
Contents?: true
Size: 878 Bytes
Versions: 7
Compression:
Stored size: 878 Bytes
Contents
require_relative '../cors_headers' module Onsi module Middleware ## # Auto-Add CORS headers to all requests. # # @example Setup The middleware # # in config/application.rb # module CoolApp # class Application < Rails::Application # config.middleware.use(Onsi::Middleware::CORSHeaders) # end # end class CORSHeaders ## # @private # # Create a new instance of the middleware. # # @param app [] Rack App def initialize(app) @app = app end ## # @private # # Called by the Middleware stack. def call(env) status, headers, body = @app.call(env) cors_headers = Onsi::CORSHeaders.generate(env) [ status, cors_headers.merge(headers), body ] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems