class Rack::Cors::Result
Constants
- HEADER_KEY
- MISS_DENY_HEADER
- MISS_DENY_METHOD
- MISS_NO_METHOD
- MISS_NO_ORIGIN
- MISS_NO_PATH
Attributes
hit[RW]
miss_reason[RW]
preflight[RW]
Public Class Methods
hit(env)
click to toggle source
# File lib/rack/cors.rb, line 248 def self.hit(env) r = Result.new r.preflight = false r.hit = true env[RACK_CORS] = r end
miss(env, reason)
click to toggle source
# File lib/rack/cors.rb, line 255 def self.miss(env, reason) r = Result.new r.preflight = false r.hit = false r.miss_reason = reason env[RACK_CORS] = r end
preflight(env)
click to toggle source
# File lib/rack/cors.rb, line 263 def self.preflight(env) r = Result.new r.preflight = true env[RACK_CORS] = r end
Public Instance Methods
append_header(headers)
click to toggle source
# File lib/rack/cors.rb, line 270 def append_header(headers) headers[HEADER_KEY] = if hit? preflight? ? 'preflight-hit' : 'hit' else [ (preflight? ? 'preflight-miss' : 'miss'), miss_reason ].join('; ') end end
hit?()
click to toggle source
# File lib/rack/cors.rb, line 235 def hit? !!hit end
miss(reason)
click to toggle source
# File lib/rack/cors.rb, line 243 def miss(reason) self.hit = false self.miss_reason = reason end
preflight?()
click to toggle source
# File lib/rack/cors.rb, line 239 def preflight? !!preflight end