Class: Makara::Middleware
- Inherits:
-
Object
- Object
- Makara::Middleware
- Defined in:
- lib/makara/middleware.rb
Constant Summary collapse
- IDENTIFIER =
'_mkra_ctxt'
- DEFAULT_COOKIE =
{ :path => '/', :http_only => true, :max_age => '5' }
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, cookie_options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, cookie_options = {}) ⇒ Middleware
Returns a new instance of Middleware.
19 20 21 22 |
# File 'lib/makara/middleware.rb', line 19 def initialize(app, = {}) @app = app @cookie = DEFAULT_COOKIE.merge() end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/makara/middleware.rb', line 25 def call(env) return @app.call(env) if ignore_request?(env) Makara::Context.set_previous previous_context(env) Makara::Context.set_current new_context(env) status, headers, body = @app.call(env) store_context(status, headers) [status, headers, body] end |