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 232 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 239 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 247 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 254 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 219 def hit? !!hit end
miss(reason)
click to toggle source
# File lib/rack/cors.rb, line 227 def miss(reason) self.hit = false self.miss_reason = reason end
preflight?()
click to toggle source
# File lib/rack/cors.rb, line 223 def preflight? !!preflight end